Eclipse C++ : "Program "g++" not found in PATH"

Viewed 272878

I have gpp installed in my Windows 7 (32 bit) as shown in the picture.

enter image description here

PATH variable gas g++

"%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\g++"

Still eclipse shows the error:

"Program "g++" not found in PATH".

How can this be resolved?

enter image description here

22 Answers

For me it got fixed with:

Go to: Window -> Preferences -> C/C++ -> Build -> Environment

Then press "Add..."

Name: MINGW_HOME

Value: C:\MinGW (yours might be different if you choose a custom path)

Hit "Apply and Close"

Now, it shoud work if you did everything correctly

The reason is that eclipse cannot find your gcc or g++ environment variable path.

You might have tried to run c or c++ or fortran but eclipse cannot find out the compiler.

So, add the path in your environment variable.

  1. Windows -> Search -environment variables -> click on environmental variables at bottom.

  2. Click on path ->edit -> new -> your variable path

Path should be entire, for example:

C:\Users\mahidhai\cygwin64\usr\sbin

Make sure that the variable is permanently stored. It is not erased after you close the environment variables GUI.

Sometimes you might find it difficult to add a path variable. Make sure windows is updated.

Even if Windows is updated and you have problems, directly go to the registry and navigate to the below.

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

Add your path here. Remove any unnecessary repetitions of path variables.

Note: You need to add your path variables in system environment variables -path

enter image description hereIf you just want to run C program but meet this error, it might mean that MinGw c++ compiler has not been installed even if "C:\MinGW\bin" has already been added to Windows Path variable.

Solution:

  1. Run "mingw-get-setup.exe" to open MinGW Installation Manager

  2. Open All Packages->MinGw->MinGW Base System->MinGW Compiler Suite

  3. Select the following compilers to install:

    . mingw32-gcc-g++

    . mingw32-gcc-v3-core

    . mingw32-gcc-vc-g++

  4. Click Installation->Apply Changes to apply the above changes

  5. Wait for the installation finishing(There might be some errors, just ignore them).

  6. Restart Eclipse.

  7. Done.

It Worked in my environment.

Hope it works in your case.

Related