1
votes

I can't get the following code to run:

#include <iostream>
int main()
{
    std::cout << "Hello World" << std::endl;
    return 0;
}

There are no compile errors. The build output:

18:18:58 **** Incremental Build of configuration Debug for project First Project ****
Info: Internal Builder is used for build
g++ "-Ic:\\mingw\\lib\\gcc\\mingw32\\4.8.1\\include\\c++" "-Ic:\\mingw\\lib\\gcc\\mingw32\\4.8.1\\include\\c++\\mingw32" "-Ic:\\mingw\\lib\\gcc\\mingw32\\4.8.1\\include\\c++\\backward" "-Ic:\\mingw\\lib\\gcc\\mingw32\\4.8.1\\include" "-Ic:\\mingw\\include" "-Ic:\\mingw\\lib\\gcc\\mingw32\\4.8.1\\include-fixed" -O0 -g3 -Wall -c -fmessage-length=0 -o Hello.o "..\\Hello.cpp" 

18:18:58 Build Finished (took 166ms)

I get the dreaded "Launch failed. Binary not found." dialog. I've been over google for hours now, but nothing works. In my project folder, a debug or release folder are created (depending on what I set it to) but it's always empty. No 'binaries' folder is created, as some posts mentioned it should. No proposed solution worked, and disabling the antivirus didn't solve it. How do I fix this? Thank you.

EDIT Eclipse Version Kepler Severive Release 1 Build id: 20130919-0819 CDT Version: 8.3.0.201402142303

I'm using MinGW

EDIT2 Changing the "current builder" in properties>c/c++ build>tool chain editor from CDT internal builder to Gnu Make Builder does generate a makefile. Output: 13:57:41 ** Auto Build of configuration Debug for project First Project ** make all Building file: ../Hello.cpp Invoking: GCC C++ Compiler g++ -I"c:\mingw\lib\gcc\mingw32\4.8.1\include\c++" - I"c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\mingw32" - I"c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\backward" -I"c:\mingw\lib\gcc\mingw32\4.8.1\include" -I"c:\mingw\include" -I"c:\mingw\lib\gcc\mingw32\4.8.1\include-fixed" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Hello.d" -MT"Hello.d" -o "Hello.o" "../Hello.cpp" make: * [Hello.o] Error 1

13:57:42 Build Finished (took 881ms)

3
Looks like you are only compiling, not linking.youdontneedtothankme
You are only compiling the source. There is no link stage in the log.n. 1.8e9-where's-my-share m.
In the Project Explorer view under Debug or Release, do you see an auto-generated "makefile"? Could you post that also? What version of Eclipse are you using?aschepler
"I'm using MinGW" - there's your real problem.Daniel Kamil Kozar
I changed the "current builder" in properties>c/c++ build>tool chain editor from CDT internal builder to Gnu Make Builder, and now it does generate "makefile", as well as objects.mk, sources.mk and subdir.mk. Should I post the contents of the makefile?DSPC

3 Answers

2
votes

Which compiler are you using? It appears that you are only compiling your code, not linking it too. You must build and link in order for it to work.

0
votes

The -c flag only compiles the source file. It doesn't link with the object file into an executable. Add this:

g++ -o "..\\Hello.exe" "..\\Hello.o" && "..\\Hello.exe"
0
votes

Just remove -c flag from your compile line and change -o Hello.o to -o Hello.exe (guess you use Windows).