Program "g++ not found in path" in Eclipse Juno CDT in Ubuntu

Eclipse 6月的CDT报告g++ not found in path ,如何解决这个问题?


Typically, g++ will be installed when gcc (GNU Compiler Collection) is installed. First confirm that you have g++ installed.

You can check this by typing the following in a terminal: which g++. The response ought to be /usr/bin/g++.

If you find g++ installed, in eclipse go to project->properties->C/C++ Build->Discovery Options, under tools GCC C++ Compiler, put the exact path to g++ instead of g++ (if g++ alone does not work).

You will find this link useful: What is the difference between g++ and gcc?

If you still have problems, do get back with feedback.


I had similar problem and it is solved by

  • Installing g++ The GNU C++ complier using ubuntu software centre and

  • Changing in -

    Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery -> CDT GCC Build in Complier Settings [Shared]

    From: ${COMMAND} -E -P -v -dD "${INPUTS}"

    To: /usr/bin/${COMMAND} -E -P -v -dD "${INPUTS}"

  • I hope it helps. I think if you add it to the project as mentioned in the first answer, you will need to add all the time for new projects. And if you add as I wrote you don't need to add it for new projects.


    I have exactly the same problem. I never had problems with eclipse before under linux and now it wont even compile code. I tried to change the name of the g++ and gcc compilers to their exact location in project->properties->c/c++ Build->discovery options etc. nothing helped, I tried to reinstall eclipse and did an initialize, added the path to the variables etc.. Nothing worked so fare. The project I am working on is quiet big and I rather would like eclipse to manage the source and makefile, instead of doing it manually

    Linux Mint 15 Eclispe: Version: 3.8.1 (I tried it with the latest version as well ... nothing changed)

    g++ --version g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    gcc --version gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    example:

    #include // not resolved using namespace std;
    
    int main() {
        std::cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
        return 0;
    }
    

    Well the code above is not what bothers me, as I can fix it by adding the includes of the exact c++ include path, but the code just wont compile. Wired enough eclipse gives me the error:

    Description Resource Path Location Type Program "g++" not found in PATH Preferences, C++/Build/Settings/Discovery, [CDT GCC Builtin Compiler Settings] options C/C++ Scanner Discovery Problem

    but it appears to me to be possible to compile single files, by opening them and pressing crt+b, but the whole project wont compile.

    Fixed the problem this morning:
    - got the latest eclipse
    - created a new workspace
    - created a new project

    after a few seconds the very same error disappears

    链接地址: http://www.djcxy.com/p/85752.html

    上一篇: 用gcc / g ++编译器编译c ++

    下一篇: 在Ubuntu的Eclipse Juno CDT中编写“g ++ not found in path”