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

- 32,014
- 33
- 141
- 226

- 5,549
- 7
- 49
- 70
-
Did you install g++? Also, in eclipse you may have to set the compiler path in preferences. – scaryrawr Oct 08 '12 at 02:32
5 Answers
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.
-
version option gives me "g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3" – Fermat's Little Student Oct 08 '12 at 03:27
-
1I set "compiler invocation command" into the exact path.nothing changes. also,is there a fix that does fixing for all projects instead of one? – Fermat's Little Student Oct 08 '12 at 03:44
-
So it clear that you have g++ installed on the box. This points to the path not being correct in eclipse. Try adding the path variable to the evironment here: window->preferences->C/C++->build->Environment. – bobestm Oct 08 '12 at 20:39
-
My problem solves after install g++, restart eclipse, build project. Eclipse Kepler, Ubuntu 12.04. – Peng Zhang Jan 16 '14 at 02:34
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.

- 201
- 3
- 3
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

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

- 1,722
- 1
- 27
- 43
Creating a new Workspace directory on Eclipse startup solved the problem for me.

- 1,411
- 2
- 23
- 29