4

I have a rather embarrasing question, as this problem was no issue on a linux machine and on my Windows XP machine. But now, after having finally switched to Windows 7 64bit, I ran into the basic problem of making Eclipse find my C++ include files...

My setting:
I am running Windows 7 64bit. I have installed cygwin to "C:\Program Files\cygwin" and Eclipse Juno 64bit to "C:\Program Files\eclipse".

My problem:
I created a basic "Hello World" C++ Makefile project with Cygwin toolchain. Compilation works without problems, but Eclipse still complains that it cannot find the include to "iostream".

What I tried:
In Project Properties -> C/C++ General -> Paths and Symbols -> Includes, I set the Include directory for GNU C and GNU C++ to

C:\Program Files\cygwin\lib\gcc\i686-pc-cygwin\4.5.3\include

which contains the iostream include in a subdirectory. This didn't work

Then I tried the exact directory

C:\Program Files\cygwin\lib\gcc\i686-pc-cygwin\4.5.3\include\C++

containing iostream. This time, the include was found, but even after rebuilding the index, Eclipse still coulnd't resolve std, cout and endl. Then I tried the include directory of the 3.x version of gcc

C:\Program Files\cygwin\lib\gcc\i686-pc-cygwin\3.4.4\include\C++

and it worked. Unfortunately, I require the 4.x version of gcc, so this is no permanent solution for me.

My Question:
How I can I resolve this problem and make Eclipse find the gcc 4.x include directories and use them correctly?

shiin
  • 462
  • 6
  • 17

1 Answers1

2

Instead of changing your project-specific changes, you have to make Eclipse 'forget' and re-discover your compiler's include directories. Do this via Windows | Preferences | C/C++ | Build | Settings ; you need to clear the 'Discovery' entries for gcc.

see also this question.

Community
  • 1
  • 1
einpoklum
  • 118,144
  • 57
  • 340
  • 684