• Advertisement
Sign in to follow this  

SDL Release Build Problems

This topic is 1914 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have made a simple PONG game for my school project in VC++ 2010 using SDL. When i build the Release build inside VC++ it works perfectly fine, but when i try running the .exe from the solution folder, Nothing happens at all.

My SDL project does include .png files.

Can someone pls tell me how to build a proper release so that i can take it in a pendrive and install it on other comps?

Share this post


Link to post
Share on other sites
Advertisement
For each of your assets (sounds, images, fonts, etc...) you are loading, do you do proper error checking and report the error messages in text files somewhere? What do the errors say?

Have you put the SDL libraries in the same folder as your executable?

Share this post


Link to post
Share on other sites

For each of your assets (sounds, images, fonts, etc...) you are loading, do you do proper error checking and report the error messages in text files somewhere? What do the errors say?

Have you put the SDL libraries in the same folder as your executable?


No, Just included the dll files, what all exactly do i have to put in the executable folder and how do i do the error checking?

Share this post


Link to post
Share on other sites
OK i got it working, just had to copy the image files,dlls and exe into a release folder inside another folder in my solution folder.

THANKS!

Share this post


Link to post
Share on other sites
Glad you got it working!

Just included the dll files, what all exactly do i have to put in the executable folder

You need:

  • The executable
  • The .dlls (on windows) in the same folder as the .exe
  • Your assets, in the correct path your game uses.
    ([size=2]If you load a file as "./data/myImage.png" your game needs to have a 'data' folder next to the executable, with myImage.png inside it)


    and how do i do the error checking?[/quote]
    Depends on the API. For SDL, something like this might work:
    SDL_surface *myImage1 = SDL_LoadIMG("myImage1.png");
    if(!myImage)
    {
    //Uh oh, the image didn't load properly! Report an error.
    std::cerr << "Failed to load the image. SDL's error: " << SDL_GetError() << std::endl;
    }

    [size=2](This is from memory, so that code might not work)

    SDL (I think) reroutes std::cout to a file called stdout.txt next to your program's executable, and std::cerr to a file called stderr.txt.

    That needs to happen for almost every asset you load, otherwise it's harder to figure out where mistakes are.
    Always make your program confirm that everything worked, and always make it report, detailedly, any deviation from your expectations. Make your program do your problem-solving for you.

    You said in your first post, "when i try running the .exe from the solution folder, Nothing happens at all."
    With computers, something always happens. You just can't always see it. Your work depends on whether you can find out what happened... and it's easier if you make your program just tell you the 'what' so you can focus on the more-important 'why'.

    When my program runs, it tells me:
    [size=2]"Unable to find any file at "[color=#008080]%GUI-PATH%/Editor/TilePlacementBar/TileDisplayWidget/BlendModes/Mask.png", in any mod, expansion, or the main game folder."

    Or:
    [size=2]"Trying to get a chunk that isn't loaded.
    [size=2]Area: '[color=#008080]Untitled'
    [size=2]VisibleChunkLoc: [color=#FF0000](0, 0)"

    The more detailed your program's error reporting is, the quicker you find where the errors are, and the sooner you fix them. Some people's error reporting includes italics/bold/underlining, text coloration, and other stuff to make it even easier to identify what's wrong. I currently output mine as .rtf files, but HTML and CSS files are also commonly used (and I want to migrate to those myself in the future), but even plaintext can save you hours of work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement