Search code examples
c++eclipseeclipse-cdt

Newbie Problem: C/C++ with Eclipse


My setup includes: Windows Vista, Eclipse 3.5.0, and gdb, make, gcc 3.4.4, g++ 3.4.4 enabled through Cygwin, and environmental variable is already set.

My FIRST problem is that I can run and build an application like the information in Console:

**** Build of configuration Debug for project HelloWorld ****

make all <br />
Building file: ../src/HelloWorld.cpp <br />
Invoking: Cygwin C++ Compiler <br />
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/HelloWorld.d" <br /> -MT"src/HelloWorld.d" -o"src/HelloWorld.o" "../src/HelloWorld.cpp" <br />
Finished building: ../src/HelloWorld.cpp <br />

Building target: HelloWorld.exe <br />
Invoking: Cygwin C++ Linker <br />
g++  -o"HelloWorld.exe"  ./src/HelloWorld.o  <br />  
Finished building target: HelloWorld.exe <br />

But in the Problems view, I still have the following warnings,

Error launching external scanner info generator (g++ -E -P -v -dD F:/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp) <br />
Error launching external scanner info generator (g++ -E -P -v -dD F:/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp) <br />
Error launching external scanner info generator (gcc -E -P -v -dD F:/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c)   <br />
Error launching external scanner info generator (gcc -E -P -v -dD F:/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c)

My SECOND problem is that I have set up PATH but I cannot run 'g++ --version' and 'gcc --version' in the windows command, while 'make', 'gdb', 'gcc-3', and 'g++-3' work.
Does anyone know what I can do to fix those problems? Is the second problem related to the first problem?

Thanks

Hank


Solution

  • What is sure is your second problem could very well be related to your first issue:
    From this thread:

    Make sure gcc is installed and on the system PATH.

    This other thread states the obvious:

    a PATH env var change via the OS GUI won't take effect in an already running app (Eclipse), including an already open console window.
    If you're re-launching Eclipse after the PATH change, you're not doing so from an existing console window, right?
    Also, try copying the gcc.exe executable to c:\WINNT just as a test. It won't work from there stand-alone, but you should at least see some difference that will help you determine if your problem is indeed a PATH one.

    For, cygwin environment, other hacks are possible:

    • Recent versions of Cygwin no longer have gcc.exe or g++.exe. These files have been replaced with .lnk files that point to gcc-3.exe and g++-3.exe (or whatever)

    • Some tools in Eclipse need to launch "gcc" or "g++" to generate some sort of info. The OS cannot find gcc.exe or g++.exe and so it returns an error.

    • I have found that the following procedure works for me:
      1/ delete gcc.exe.lnk and g++.exe.lnk from cygwin/bin
      2/ Copy gcc-3.exe to gcc.exe
      3/ Copy g++-3.exe to g++.exe


    Be aware though there: