5

I am using Eclipse for a C project. I created a new Project by going to New->C project->Executable->Empty Project, Linux gcc toolchain.

When I add a new .c file, I get "program 'g++' not found in path". How do I get rid of this? I'm not even using C++.

user1190650
  • 3,207
  • 6
  • 27
  • 34

5 Answers5

10

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.

Rubens
  • 14,478
  • 11
  • 63
  • 92
Shashi
  • 201
  • 3
  • 3
2

For posterity I'm going to post my own solution to this problem. None of the answers above or on related StackOverflow questions helped; most referred to menu entries that didn't exist, and the ones I could try did nothing. I searched other sites as well; there were about 6 different answers repeated many times, and none helped.

Short answer: I blew away the Eclipse install and replaced it. Then it worked. For me at least it wasn't a project or configuration option (at least not one I could get to from the GUI); something in the Eclipse program folder had gotten tweaked and only a new install could repair the problem.

I'm doing Android development using the "ADT" (Android Developer Tools) build of Eclipse. I did something to the configuration that made it start giving the above error (actually two errors, for gcc and g++ both). And I tried plenty of potential solutions (in addition to my own searching for options that might help) with no success.

Thing is, I didn't NEED gcc or g++ in the path. I'm doing Android development, and while both are used in the build process, I'm not using Eclipse to do the builds; I use the Android build system. And the C/C++ Build/Discovery options didn't even give me an option for setting paths for gcc or g++. Other answers I found elsewhere referenced menu entries that don't exist, and most seemed to be about helping people to use the normal C/C++ build within Eclipse, which I didn't need to do.

So I used this opportunity to download the latest ADT package from Google, and then I ran the new one, importing the existing project into a new workspace (just in case the old workspace was corrupted or otherwise part of the problem). No more annoying gcc/g++ error.

SomeCallMeTim
  • 4,503
  • 2
  • 28
  • 27
0

I got the same error while I was using "Eclipse IDE for C/C++ Developers."

Install Eclipse from Ubuntu Software Center and then download and install Eclipse CDT.

To install CDT, open Eclipse -> Help -> Install New Software -> Add -> Archieve... Then give CDT path to there. That's all

mamba4ever
  • 2,662
  • 4
  • 28
  • 46
0

I was able to fix the problem by selecting

project(right click in Project Explorer on your project)->properties->Tool Chain Editor

and switching the Current Toolchain: to Android GCC and Current Buolder: to Android Builder

user330844
  • 872
  • 1
  • 12
  • 12
0

I also had the same problem. I did not have this error running my program but after a adding, including different Api and paths , probably unintentionally some changes happened in my Path that I could not fix it. I could fix this error by going to Properties and just restore default for all the Tabs.

Shara
  • 1
  • 2