[Linux] Mint

I wrote the following code from an SDL book I have and it seems to be building just fine but when I go to run the program I get this error -> "Launch failed, Binary not found." I used Eclipse as my IDE and the setting are adjusted to the book's specifications.

Build feedback
10:56:43 **** Incremental Build of configuration Debug for project 2.1-Surfaces ****
make all
make: Nothing to be done for 'all'.

10:56:43 Build Finished (took 65ms)

Debug Directory Contents
main.d main.o makefile objects.mk sources.mk subdir.mk

Code

#include <SDL/SDL.h>

SDL_Surface *image = NULL;
SDL_Surface * backbuffer = NULL;

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

        return 0;
    }

    backbuffer = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE);
    SDL_WM_SetCaption("SDL!!!", NULL);

    // load the image
    image = SDL_LoadBMP("graphics/image.bmp");

    if(image == NULL)
    {
        printf("Image failed to load!\n");
        SDL_Quit();

        return 0;
    }

    // draw the image
    SDL_BlitSurface(image, NULL, backbuffer, NULL);
    SDL_Flip(backbuffer);

    // wait
    SDL_Delay(3000);

    // finish
    SDL_FreeSurface(image);
    SDL_Quit();

    return 1;
}

Recommended Answers

All 6 Replies

It appears to me you're using deprecated functions with the new librairies. Searching the forums for SDL can give you more information.

I'm using code from my sdl book and it doesn't seem to be a dated book. The book is using SDL 1.2 and I have that installed, but I may also have SDL2 installed and I don't know which version my program is linking to. Any ideas?

You'll probably be better off converting the code to use the newest library, rather than using an older library with deprecated functions. The author of the book might have updated code on his/her or the publisher's website. Alternatively the SDL website has a guide for migrating code to the newer library.

Do you see any specific deprecated functions I've used?

I found the problem, it wasn't with my program it was my IDE. I navigated to the directory using the terminal and it executed just fine, only when I try to run it from Eclipse does it give me the error that there is not binary file.

Please remember to mark the post solved if your question is answered Thank You

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.