Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Build but no executable(My build is successful but there's not executable)
Build but no executable [message #1712421] Sat, 24 October 2015 01:50 Go to next message
Garrett Gaston is currently offline Garrett GastonFriend
Messages: 11
Registered: February 2015
Junior Member
[Linux]
When I build the program below the build is successful but I don't see an executable in the project's debug directory.

#include <SDL/SDL.h>

int main(int argc, char* argv[])
{
if(SDL_INIT_EVERYTHING < 0)
{
printf("SDL failed to initialize!");
SDL_Quit();

return 0;
}

SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE);
SDL_WM_SetCaption("SDL!!!", NULL);
SDL_Delay(3000);
SDL_Quit();

return 1;
}

20:46:47 **** Incremental Build of configuration Debug for project Listing2.1-A_Blank_Window ****
make all
make: Nothing to be done for `all'.

20:46:48 Build Finished (took 88ms)

And here's what I get when I run ls in the project's Debug directory.

garrett@mint-desktop ~/projects/EclipseProjects/Listing2.1-A_Blank_Window/Debug $ ls
Listing2.1-A_Blank_Window main.d main.o makefile objects.mk sources.mk subdir.mk


And I get the error 'Launch failed. Binary not found' when I click on run. Any ideas? Thanks.
Re: Build but no executable [message #1712460 is a reply to message #1712421] Sun, 25 October 2015 12:17 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Is that your entire build log? It says it didn't do anything.
Clean the project then build again. The build log should tell you where the binary went.

If it still doesn't appear you will need to find out what make thinks there is to do.
Make can be pretty opaque but you can get debugging info see: https://www.gnu.org/software/make/manual/html_node/Options-Summary.html
Read the -d and --debug= options. The output isn't the easiest to read though.

You can edit the make command in Project ==> Properties ==> C/C++ Build to add debug options.





Re: Build but no executable [message #1712470 is a reply to message #1712460] Sun, 25 October 2015 16:52 Go to previous messageGo to next message
Garrett Gaston is currently offline Garrett GastonFriend
Messages: 11
Registered: February 2015
Junior Member
I cleaned the project and did a rebuild but I'm still not getting a binary executable files.

11:47:50 **** Build of configuration Debug for project Listing2.1-A_Blank_Window ****
make all
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
Finished building: ../main.cpp

Building target: Listing2.1-A_Blank_Window
Invoking: GCC C++ Linker
g++ -o "Listing2.1-A_Blank_Window" ./main.o -lSDL
Finished building target: Listing2.1-A_Blank_Window


11:47:50 Build Finished (took 236ms)


ls shows that there is no binary executable in the directory and I get the same error message when I try and run the program from Eclipse.
Re: Build but no executable [message #1712471 is a reply to message #1712470] Sun, 25 October 2015 16:59 Go to previous messageGo to next message
Garrett Gaston is currently offline Garrett GastonFriend
Messages: 11
Registered: February 2015
Junior Member
Wait, it is creating a binary file and I am able to run it just fine but only if I run it via the CLI. If I try and run it from Eclipse I still get this error message. -> Launch Failed: Binary not found.
Re: Build but no executable [message #1712485 is a reply to message #1712471] Sun, 25 October 2015 22:20 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Then you need a launch configuration.

http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.debug.application.doc%2Ftasks%2Fcdt_t_new_run_config.htm



Re: Build but no executable [message #1712572 is a reply to message #1712485] Mon, 26 October 2015 14:26 Go to previous messageGo to next message
Garrett Gaston is currently offline Garrett GastonFriend
Messages: 11
Registered: February 2015
Junior Member
I found that configuration screen and I added ${ProjName} to the C/C++ Application field and now i'm getting this error when I try to launch. -> Reference to undefined variable ProjName
Re: Build but no executable [message #1712573 is a reply to message #1712572] Mon, 26 October 2015 14:33 Go to previous messageGo to next message
Garrett Gaston is currently offline Garrett GastonFriend
Messages: 11
Registered: February 2015
Junior Member
Okay so I've got it sorta working. Now in launches but it does give me an error message first saying that there are error with my project. In then asks me if I want to continue and if I select yes the program does execute. But why am I having to do this. Sometimes Eclipse runs the program without complaint and other times it can't find a binary file and I have to set this up manually?
Re: Build but no executable [message #1712578 is a reply to message #1712573] Mon, 26 October 2015 15:29 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Are the errors phantom, i.e., only those generated by the indexer and syntax analyzer? If so you can delete them in the Problems view. They will come back on the next build so it's best to figure out what's causing them then fix them. If they are real what's the point of debugging?

I have no idea why it can't find the executable at times. My guess is that it gets deleted during the build process which won't complete in the face of real errors. I don't use managed builds so can't say for sure. My make files don't clean out the executables so I have to pay attention to the build to see if there are build errors.

There's some work being done on a stand-alone debugger which may circumvent some of your problems ( https://wiki.eclipse.org/CDT/StandaloneDebugger) but that seems a rather heavy handed solution if it's a solution at all.

[Updated on: Mon, 26 October 2015 15:55]

Report message to a moderator

Re: Build but no executable [message #1712622 is a reply to message #1712578] Mon, 26 October 2015 21:24 Go to previous message
Henning Riedel is currently offline Henning RiedelFriend
Messages: 310
Registered: July 2009
Senior Member
In case your Linux (?) shows no executable:
* Did you look in the right directory?
* Is the created binary actually have executable permissions? (chmod +ux)
* Did it actually build?

If the Binary is not build?
* Did you save your files before building? There are general Eclipse
Workspace options, for building, which might be set to default values
suitable for Java or other languages, but not for C/C++.
Check the Eclipse Preferences -> General -> Workspace -> "Save
automatically before build", which will save all opened and not saved
yet files, before starting to build. Btw., I usually also have "Refresh
on Access" enabled, in case some external program changes a file, like
if the compiler creates besides an .elf file also the .map file, or a
post-process script updates the resource consumption files.

* Check the build console output. I prefer the build console, to
check the build status and if there are any failures (compile and/or
link errors). And I usually go from top to bottom. Why, because the
Problems View might sort them in different order, and sometimes, later
compile/linker errors might be due to errors in the beginning, like due
to a missing include of a header, you have none or the wrong datatype,
which can have the effect, that the compiler takes the wrong prototype
of a function.
For this, I usually enable usually in Eclipse -> Preferences -> C/C++
-> Build -> Console to "Bring the Build Console to top when building"
and set the "Limit Console output (number of lines) to the maximum
setable value in order to have the first lines still in the output window.



Am 26.10.2015 um 16:29 schrieb David Vavra:
> Are the errors real, i.e., only those generated by the indexer and
> syntax analyzer? If so you can delete them in the Problems view. They
> will come back on the next build so it's best to figure out what's
> causing them then fix them. If they are real what's the point of debugging?
>
> I have no idea why it can't find the executable at times. My guess is
> that it gets deleted during the build process which won't complete in
> the face of real errors. I don't use managed builds so can't say for
> sure. My make files don't clean out the executables so I have to pay
> attention to the build to see if there are build errors.
>
> There's some work being done on a stand-alone debugger which may
> circumvent some of your problems (
> https://wiki.eclipse.org/CDT/StandaloneDebugger) but that seems a rather
> heavy handed solution.
>
>
Previous Topic:Extend GCC language
Next Topic:Excluded files
Goto Forum:
  


Current Time: Wed Sep 18 23:36:22 GMT 2024

Powered by FUDForum. Page generated in 0.04416 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top