Jump to content
  • Advertisement
Sign in to follow this  
Chrono1081

SDL Building but nothing executing :'(

This topic is 3722 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 was playing around with SDL again as I think I am ready for that step this time and I loaded everything first, according to lazy foos instructions then again according to the instructions in "Focus on SDL" and everything works find, the build works, but then when I hit "Run without Debug" nothing. The screen does something (like a very quick flash) but its not bringing up a box or anything. (The programs I was trying put windows on the screen). I have tried uninstalling and reinstalling, doing clean rebuilds, different sdl files, everything I can think of. Is there a setting somewhere I am missing? Like I said, everything builds just fine, but the execute part just doesn't work.

Share this post


Link to post
Share on other sites
Advertisement
The same thing : / Although here is what debug says:

'SDL.exe': Loaded 'C:\Documents and Settings\Owner\Desktop\Wrathlands\SDL\Debug\SDL.exe', Symbols loaded.
'SDL.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\SDL.dll', Binary was not built with debug information.
'SDL.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\user32.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\winmm.dll'
'SDL.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456\msvcp90d.dll', Symbols loaded.
'SDL.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456\msvcr90d.dll', Symbols loaded.
'SDL.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375\msvcr90.dll', Symbols loaded.
'SDL.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll'
'SDL.exe': Unloaded 'C:\WINDOWS\system32\ddraw.dll'
'SDL.exe': Unloaded 'C:\WINDOWS\system32\dciman32.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\kbdus.dll'
'SDL.exe': Unloaded 'C:\WINDOWS\system32\kbdus.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\kbdus.dll'
'SDL.exe': Unloaded 'C:\WINDOWS\system32\kbdus.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\dsound.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\ole32.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\version.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\dinput.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\hid.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\wintrust.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\crypt32.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\msasn1.dll'
'SDL.exe': Loaded 'C:\WINDOWS\system32\imagehlp.dll'
The thread 'Win32 Thread' (0x960) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x96c) has exited with code 0 (0x0).
The program '[2380] SDL.exe: Native' has exited with code 0 (0x0).




Here is the code I am using:


#include "SDL/SDL.h"

int main( int argc, char* args[] )
{

SDL_Init( SDL_INIT_EVERYTHING );


SDL_Quit();

return 0;
}

Share this post


Link to post
Share on other sites
Correct me if I'm wrong, but I think you have to put a loop in there that's polling for events and then wait for the user to quit, if you want a window to stay up there. For example in pseudo code because I don't remember SDL.. it's been quite a while since I used it:

int main()
{
int running;
SDL_Init(SDL_INIT_EVERYTHING);
running = 1;
while(running)
{
if(PollEvents() == EXIT || PollEvents() == KEY_ESCAPE)
{
running = 0;
}
//other code
}
SDL_Quit();
return 0;
}

Does that make sense? In your program you are just opening a program and then closing it right off the bat. You need to wait for the user to close it.
Hope this helps!

Share this post


Link to post
Share on other sites
Unfortunatly it does it for all the code I try : / Lazyfoos code does it as well as the code from "Focus on SDL". It only does it with SDL code too, regular C++ code works fine.

Share this post


Link to post
Share on other sites
It is doing exactly what you are telling it to.

Try:


#include "SDL.h"

int main(int argc, char * argv[])
{
SDL_Surface * videoSurface = NULL;
int running = 1;

SDL_Init(SDL_INIT_VIDEO);
videoSurface = SDL_SetVideoMode(800, 600, 0, SDL_DOUBLEBUF);

while(running)
{
SDL_Event event;
while(SDL_PollEvent(&event))
{
if(event.type == SDL_QUIT)
{
running = 0;
}
}

SDL_Flip(videoSurface);
}

SDL_Quit();
return 0;
}


Share this post


Link to post
Share on other sites
Quote:
Original post by Chrono1081
Unfortunatly it does it for all the code I try : / Lazyfoos code does it as well as the code from "Focus on SDL". It only does it with SDL code too, regular C++ code works fine.


Oh, I was going off the example that you were showing, but then I realized to open a window you would have to create a surface for the screen and declare all of that good stuff before you could do anything anyways. At the time I didn't know that that wasn't the whole program.

Share this post


Link to post
Share on other sites
Yes that worked! Thank you! This is literally my first foray into programming sdl so I really didn't know how to troubleshoot. On my old computer I was used to seeing a box pop up super fast then close which is why I thought it was a setting verses the box just closing. (Guess my new computer is just that awesomely fast :P) Thank you for all the help guys :)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!