5
votes

My goal is to use CMake with Eclipse CDT. A tiny CMakeLists.txt file from every tutorial works well for me, and Eclipse succesfully imports and builds the generated project. But after building it doesn't see the binary ("Launch failed. Binary not found.") because it goes into the root project directory, not in Debug/ or Release/ (or the project lacks some metadata).

How to build executables recognized by Eclipse?

3

3 Answers

4
votes

you have to create a new run configuration. go to run > run configurations > C\C++ Application and follow instructions, press the new configuration button if you have the example hello world project you can copy the setup.

I added debug\"Program Name" under C\C++ application

2
votes

I just had the same error, and here is what I did:

Proper binary parser must be selected so Eclipse can recognize the executable: Select the project, then right click.

Project->Properties->C/C++ Build->Settings->Binary Parsers, PE Windows Parser (or you can select Cygwin if you use that compiler).

That worked for me at least for Cross compiler.

In Linux I use Elf parser.

1
votes

First you need to make sure that the project has been build. You can do that with the hammer icon in the toolbar. You can choose to build either a Debug or Release version. If you cannot build the project then the problem is that you either don't have a compiler installed or that the IDE does not find the compiler.

To see if you have a compiler installed in a Mac you can run the following command from the command line:

g++ --version

If you have it already installed (it gets installed when you install the XCode tools) you can see its location running:

which g++

If you were able to build the project but you still get the "binary not found" message then the issue might be that a default launch configuration is not being created for the project. In that case do this:

Right click project > Run As > Run Configurations... > 

Then create a new configuration under the "C/C++ Application" section > Enter the full path to the executable file (the file that was created in the build step and that will exist in either the Debug or Release folder). Your launch configuration should look like this:

enter image description here