1

I am trying to build an lzmat_lib compression library using Eclipse with Cygwin gcc. I downloaded the library from the link http://www.matcode.com/lzmat_lib.zip. The file has the following include files:

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <tchar.h>
#include "lzmat.h"

It cannot find the tchar.h header file. I do not understand how to add this header file. Please suggest a solution.

indiv
  • 17,306
  • 6
  • 61
  • 82
user3860949
  • 115
  • 1
  • 1
  • 10
  • Take a look to this question http://stackoverflow.com/questions/6315566/should-i-eliminate-tchar-from-windows-code – Яois Jul 23 '14 at 15:57
  • @KeillRandor Thanks for your suggestion but i just do not know about UTF-8, UTF-16, Unicode etc. i actually can't get that question. :-( – user3860949 Jul 23 '14 at 16:18
  • including is like including , i.e. it is a windows compiler thing. mingw is not the windows default compiler, so it does not include the windows headers that lzmat_lib needs. – Яois Jul 23 '14 at 16:23
  • @KeillRandor does it mean i can't use lzmat_lib file with cygwin gcc. – user3860949 Jul 23 '14 at 16:25
  • Not directly, you'll have to provide a "tchar.h" of your own or remove that include line and see what happens :) – Яois Jul 23 '14 at 16:49
  • @KeillRandor it uses a datatype such as _TCHAR which is defined in tchar.h . Can i simply copied tchar.h to my include directory. – user3860949 Jul 23 '14 at 16:52

1 Answers1

1

Your options are to install a Windows development environment, like Visual Studio or mingw along with the Windows SDK, or to port the code to your cygwin (posix) environment.

To port the code, you'd just do this:

  1. Remove #include <tchar.h>.

  2. Search and replace _TCHAR to char.

  3. Search the file for all strings beginning with _t and remove that prefix. E.g., _tfopen becomes just fopen. _tprintf becomes printf.

  4. Search for the text _T and remove it. You could also remove the extra parentheses that will then surround your string.

  5. Deal with any other issues as they come up by removing the dependency on tchar.h and using a standard function instead.

indiv
  • 17,306
  • 6
  • 61
  • 82