Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

program g++ not found in path

Tags:

c

eclipse

g++

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

like image 227
user1190650 Avatar asked Sep 26 '12 20:09

user1190650


People also ask

How do I fix program not found in path?

Go to Project> Properties> C/C++ Build> Environment. You will see three fields, choose PATH. See if the folder containing make.exe is appended to the path or not.

Where is g++ path in Windows?

The PATH is locate at Project Properties > C/C++ Build > Environment (see screenshot below).

How do I add a compiler to my path?

In the Windows search bar, type 'settings' to open your Windows Settings. Search for Edit environment variables for your account. Choose the Path variable in your User variables and then select Edit. Select New and add the Mingw-w64 destination folder path to the system path.


2 Answers

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.

like image 149
Shashi Avatar answered Sep 29 '22 00:09

Shashi


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.

like image 44
SomeCallMeTim Avatar answered Sep 28 '22 23:09

SomeCallMeTim