tchar.h not found on cygwin

Jason Sundram picture Jason Sundram · Nov 12, 2010 · Viewed 11.3k times · Source

I'm running the latest cygwin on windows 7 (32-bit), and trying to build an open-source project, RtAudio (it doesn't currently build on this platform).

One of the problems I've worked around is an error on the line #include <tchar.h>.

My build line is:

g++ -O2 -Wall -Iinclude -DHAVE_GETTIMEOFDAY -D__WINDOWS_DS__ -c RtAudio.cpp -o RtAudio.o

The error is:

tchar.h: No such file or directory

If I add /usr/include/mingw (which contains tchar.h) to the list of include paths, I get a lot more errors.

I've worked around the problem by not using LPCTSTR, and just overloading the one function that requires it for const char* and const wchar_t* so I could avoid including tchar.h, but is there a better way to do this?

Answer

Ignacio Vazquez-Abrams picture Ignacio Vazquez-Abrams · Nov 12, 2010

tchar.h is a Windows header. The software will have to be ported to libiconv or ICU if it needs more than just the basics.