Dimitris Sfounis
Dimitris Sfounis

Reputation: 2500

Eclipse CDT (Juno) in Win7: Cannot find g++ in PATH, iostream unresolved and other fun stuff

I'm coming here out of desperation, you guys are my last string of hope.

I've been having the problems in the title since yesterday and for the life of me I cannot find what's wrong.

A simple hello world program cannot be built as Eclipse fails to find the g++ compiler. I've managed to find the PATH variable in Project->Properties->C++ BuildEnvironment and it's set at C:\Users\Dimitris\Documents\eclipseCPP\eclipse;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Windows Live\Shared;D:\Users\Dimitris\AppData\Local\Photran\MinGW\bin;C:\Program Files (x86)\VDownloader;E:\Program Files\VDownloader;E:\Program Files (x86)\FAHClient Obviously, something's wrong there.

For the "unresolved iostream" matter, I've tried setting up my include paths in Project->Properties->C/C++ General->Paths and Symbols->Include tab then adding the whole MinGW file system, to no avail. Surprisingly, adding a sub-tree of MinGW -namely the very level iostream was in- managed to make Eclipse see iostream, though the program still could not understand cout or std. I've got MinGW, Cygwin and cygnus installed.

The program is, as I said before, a simlpe hello world. It won't build.

#include <iostream>
using namespace std;

int main() 
{
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    return 0;
}

Upvotes: 0

Views: 1571

Answers (1)

Steve Lorimer
Steve Lorimer

Reputation: 28679

Are you sure you have g++.exe in your PATH? (I see you have D:\Users\Dimitris\AppData\Local\Photran\MinGW\bin in your path. Is there a g++.exe in there?)

If you go to your command prompt (cmd.exe) and type g++ -v enter does it find gcc and print out the version?

Another thing - how did you create your project?

If you select File -> New -> C++ project -> Hello World, and your gcc compiler is in your path, you should be good to go.

This is the output from a simple Hello world project created using the above method

** Build of configuration Debug for project foobar **

make all

Building file: ../src/foobar.cpp

Invoking: GCC C++ Compiler

g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/foobar.d" -MT"src/foobar.d" -o "src/foobar.o" "../src/foobar.cpp"

Finished building: ../src/foobar.cpp

Building target: foobar Invoking: GCC C++ Linker g++ -o "foobar" ./src/foobar.o

Finished building target: foobar

** Build Finished **

Upvotes: 1

Related Questions