user1631224
user1631224

Reputation: 409

How to install C++ plugin to Eclipse?

I have Eclipse Helios and wanted to code C++ using it, but I keep running into the "Launch failed. Binary Not found" error.

I installed the MingW C++ compiler using the "mingw-get-inst-20120426" file and selected the "C compiler, C++ compiler, MSYS Basic System, and MingW Developer Toolkit".

Then I went to Eclipse > project > properties > C/C++ General > Paths and Symbols, then selected the GNU C++ in the Includes tab and added the "C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++" path.

I also went to C/C++ build > Environment and appended the "C:\MinGW\bin;C:\MinGW\msys\1.0\bin" to the PATH.

Then I created a Hello World C++ project, selecting the MingW GCC under Toolchains, and then built the project using the "hammer" icon.

However, once I ran the HelloWorld program it gets the "Launch failed. Binary Not Found" error.

Here is another error:

g++ -IC:\MinGW\lib\gcc\mingw32\4.6.2\include\c++ -O0 -g3 -Wall -c - 
fmessage-length=0 -osrc\HelloWorld.o ..\src\HelloWorld.cpp
Internal Builder: Cannot run program "g++": The system cannot find the 
file specified.

I also downloaded the CDT (C/C++ Development Tooling) and transferred the "features" and "plugins" folder to the eclipse folder.

Can someone please give me step-by-step on how to resolve this?

Upvotes: 11

Views: 63421

Answers (4)

RS1980
RS1980

Reputation: 706

Nowadays (Eclipse Juno and newer), it is much simpler. You just need to:

  • Install MinGW (and including C++ compiler)
  • Add the paths "C:\minGW\bin" and "C:\minGW\msys\1.0\bin" (or wherever you installed MinGW to) to your Windows "Path" variable
  • Install Eclipse. If Eclise already is installed, restart it. it will recognize that MinGW is now available.
  • Create a New project: "C++ Project"
  • For every Project type in the following dialog, you should now be able to select the "MinGW GCC" toolchain
  • Happy coding

Upvotes: 9

oenpelli
oenpelli

Reputation: 3567

g++ is installed as part of MinGW. If you are getting an error in Eclipse that it cannot find g++ then your path is most likely incorrect. From a command prompt you should be able to run:

g++ --version

and it should display the version of g++ in the MinGW/bin directory.

Eclipse uses this path to locate the include files and the compiler. Once you get the path correct restart Eclipse and the problems listed in your question should be resolved.

Upvotes: 0

moskito-x
moskito-x

Reputation: 11958

Firstly, in the following examples all drive-letters should be replaced with the relevant ones on your system. Not all of these steps are really necessary, but it works (and the more the merrier).

We start with the slightly simpler release config - we want to make it compile.

Go to Project -- Properties

Look if the include directories are correct and in place.

enter image description here

Go to Project -- Properties -- Run/Debug Settings -- NEW -- Main Tab

Set to Release and Browse to the Release folder of the project. If the exe file is not set type in its name.

Properties 1

Switch to Common Tab. Check Allocate Console and Launch in Background. Don't Run yet.

Properties 2

Go to Project -- Properties -- C/C++ Build -- Discovery Options

Tools -- GCC C++ Compiler

"Browse" to the mingw bin folder and select the g++.exe or copy mingw32-g++.exe to g++.exe

Note: The image points to mingw32-g++.exe please use g++.exe

Property 3

Right click on the project and look -- Build Configurations -- Set Active -- Release is checked.

Right click on the project -- Run As -- Run Configurations.

Under C/C++ Application select, the one which refers to the release version. Then click Run

If this works, I will show you how to set the Debug Properties. (more complicated)

Upvotes: 21

dan
dan

Reputation: 13262

See here: http://www.youtube.com/watch?v=QhvXCg2CY4Q

Upvotes: 1

Related Questions