Jump to content
  • Advertisement
Sign in to follow this  
SandPatrol

SDL: Executable Build and Run Issues

This topic is 2865 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

Hi,

I have been trying to get SDL up and running with OpenGL and MinGW GCC on my new install of Windows 7; however, I seem to be having some issues. I had setup a sort of test project, and Eclipse CDT would "Build Successfully", but there would be no executable.

So, I decided to piece together the project one step at a time, building each stage so as to see where the error occurs.

I started with a simple hello world program, which worked fine. Then I added my SDL include directory to the eclipse build settings and set the lib location as well. I linked mingw32, SDLmain, and SDL in that specific order. Now when I build, the .exe file exists, and yet it does not run properly for some reason.

My code is as follows


#include <iostream>

#include "SDL/SDL.h"

int main( int argc, char* args[] ) {
std::cout << "Hello World!";

return 0;
}


When running the .exe file, nothing happens, there is no output, and the Eclipse console says "<terminated>" as if something went wrong. Even running the .exe from a command prompt (cmd.exe) or an MSYS bash prompt has the same results: absolutely nothing, a simple blank line and then a new shell prompt.

Any help would be greatly appreciated.

Thanks!
Chris

Share this post


Link to post
Share on other sites
Advertisement
This is just a guess, but check your various directories (e.g. the directory in which the executable resides) for a text file containing the text 'Hello World!'.

Unless you compile it with this feature deactivated, SDL redirects the standard output stream to a text file. I'm not sure where SDL does this exactly, but simply including the SDL header will most likely cause some SDL code to be executed, even though you're not actually invoking any SDL functions in your code. (This is because SDL does some macro trickery to co-opt the 'main' function.) If the 'redirect' is applied anywhere in that code, it could be occurring even though all you're doing is including the SDL header.

Again though, that's just a guess.

Share this post


Link to post
Share on other sites
Well, that's good to know. That would be why I could not for the life of me find out why it wasn't working. There was indeed a text file with the contents "Hello World!". Now don't I feel sheepish, haha.

Thanks,
Chris

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!