Sign in to follow this  
QwertyKey

Troubleshooting an error learning GUI

Recommended Posts

QwertyKey    122
So, I am following this tutorial: [url="http://lazyfoo.net/SDL_tutorials/lesson01/index2.php"]http://lazyfoo.net/S...on01/index2.php[/url]

What happens is that it loads up the screen, but it's black and when it closes I get a big debug page. I have added the picture "clowns.jpeg" into the same directory as the application. From what I can tell the debug message isn't a problem, but I still am not actually getting it to display an image. Can someone help me figure out what is wrong?

This is the debug message:

[code]'SDL_tutorial.exe': Loaded 'C:\Users\Ishan Mukherjee\Documents\Visual Studio 2010\Projects\SDL_tutorial\Debug\SDL_tutorial.exe', Symbols loaded.
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Users\Ishan Mukherjee\Documents\Visual Studio 2010\Projects\SDL_tutorial\Debug\SDL.dll', Binary was not built with debug information.
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Symbols loaded.
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\ddraw.dll'
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\dwmapi.dll'
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\setupapi.dll'
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\devobj.dll'
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\oleaut32.dll'
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\ole32.dll'
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\cfgmgr32.dll'
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\dciman32.dll'
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\KBDUS.DLL', Cannot find or open the PDB file
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL'
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\KBDUS.DLL', Cannot find or open the PDB file
'SDL_tutorial.exe': Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL'
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\dsound.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'SDL_tutorial.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0xf84) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xda8) has exited with code 0 (0x0).
The program '[3488] SDL_tutorial.exe: Native' has exited with code 0 (0x0).
[/code]


This is my code:

[code]#include "SDL.h"

int main( int argc, char* args[] )
{
//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;

//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );

//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

//Load image
hello = SDL_LoadBMP( "clowns.jpeg" );
//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );

//Update Screen
SDL_Flip( screen );

//Pause
SDL_Delay( 5000 );

//Free the loaded image
SDL_FreeSurface( hello );

//Quit SDL
SDL_Quit();

return 0;
}[/code]

Share this post


Link to post
Share on other sites
KazenoZ    152
You're using a .jpeg file with the BMP loading function, so it doesn't work.

Check the next tutorial [url="http://lazyfoo.net/SDL_tutorials/lesson03/index.php"]here[/url] for a way to blit other types of images(Use IMG_Load()).

On a general note though, using .jpegs isn't advised in 2D games, as they are of less quality, are lossy and usually weigh more, the preferred image types are usually .PNGs and .BMPs.

Also, this probably should've gone in the alternative game libraries forum =P

Share this post


Link to post
Share on other sites
QwertyKey    122
Thanks.

[s]I created a bmp image and it still isn't loading though.

Here is the line:

[code] hello = SDL_LoadBMP( "yo" );[/code]

I also tried with yo.bmp. The picture called yo is in the same folder as application.

[/s]Edit: Nevermind. Silly issue. I got it. Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this