6

Eclipse June CDT reports g++ not found in path, how to fix this?

exebook
  • 32,014
  • 33
  • 141
  • 226
Fermat's Little Student
  • 5,549
  • 7
  • 49
  • 70

5 Answers5

9

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.

Community
  • 1
  • 1
bobestm
  • 1,334
  • 1
  • 9
  • 8
9

I had similar problem and it is solved by

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

  2. 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.

Shashi
  • 201
  • 3
  • 3
1

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

Gregor
  • 11
  • 2
1

This issue was fixed for me once I deleted eclipse's .metedata folder, called eclipse -initialize from the command line and started eclipse again. HTH

kroiz
  • 1,722
  • 1
  • 27
  • 43
0

Creating a new Workspace directory on Eclipse startup solved the problem for me.

dh1tw
  • 1,411
  • 2
  • 23
  • 29