Tuesday, February 3, 2015

Unresolved inclusion on Eclipse

I have a C++ project which pretty well developed on Linux with Eclipse Kepler. Since this program is very well developed on Linux, I was thinking to have one Windows version as well. Since the development was done on Eclipse, the transition process should be super easy. But in fact, it wasn't.

I was using cygwin tool chain for my case, it doesn't compile as expected. There are so many unresolved error lying around, such as Unresolved inclusion: <iostream> is one of the example. This error was weird to me as the compiler was unable to find the header files. I was thinking this could be cause by cygwin path is different from regular path. Maybe path mapping could help? Go to project's properties > C/C++ > Debug >  Source Lookup Path, add a new path mapping as shown below:

Compilation path Local file system path
\cygdrive\c C:\
\cygdrive\d D:\

Since I got 2 partitions on my hard drive, I just put them all to let Eclipse search what it needs. Rebuild the project and the error still exists.

It took me a decade to work around this issue only realize that I was missing the configuration in C/C++ General > Preprocessor Include Paths, Macros etc > Providers tab > CDT GCC Builtin Compiler Settings Cygwin [shared] wasn't selected. Guess what? Without this option being selected, I suppose, to see the complain.

No comments: