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

╄→гoц情女王★ 提交于 2020-01-06 19:30:01

问题


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;
}

回答1:


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 **



来源:https://stackoverflow.com/questions/13565614/eclipse-cdt-juno-in-win7-cannot-find-g-in-path-iostream-unresolved-and-oth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!