0
101 Oct 03, 2012 at 16:16 debugging

Hello everyone, i am trying to learn C++ game development with this tutorial:

http://devmaster.net…roject-template

When i opened the template a few days ago, it worked fine. Now i open the (freshly downloaded or the one from a few days ago) template and i get an error:

http://i.imgur.com/7XvYh.png

Being new to visual studio, and being an amateur C++’er I don’t know what caused this. Can somebody clarify this?

Windows 7 64 bit / Visual Studio 2008

5 Replies

0
101 Oct 03, 2012 at 17:09

I am struggling with the same problem as well.
It doesn’t work on W7 / VC++ 2008 / Release Win32 and on W7 / VC++ 2010 / Release Win32.
DirectX SDK June installed succesfully.

0
143 Oct 03, 2012 at 19:14

The problem seems to be a null pointer access, likely due to SDL_GetVideoSurface returning NULL. (You should be able to verify that in the debugger, if you find the Locals pane and look at the value of ‘s’.) It sounds like SDL initialization is failing somewhere. One thing to try: make sure your video card drivers are up to date. Other than that I’m not sure what could be the cause.

You might try adding a line of code like:

printf("SDL error: %s\n", SDL_GetError());


Try copying that in after each SDL call (SDL_Init, SDL_SetVideoMode, etc.) in that section of code. That should hopefully display a more informative error message in the console.

0
101 Oct 04, 2012 at 18:33

it crashes before i get to see a variable named ‘s’. crashed at ‘locknum’.
If I put in the prints, it puts out “Current mouse doesn’t have cursor support” and “SetProp() failed:invalid window handle”

this is the line (in the !init() loop in template.cpp) after which no output is given anymore;

surface = new Surface( SCRWIDTH, SCRHEIGHT, (Pixel*)s->pixels, s->pitch );


any further suggestions?

0
143 Oct 04, 2012 at 18:47

I googled that SetProp error message and found this SDL forum thread: http://forums.libsdl…opic.php?t=5730 Unfortunately, they don’t seem to have come up with a solution. (I also found another thread here on DevMaster about it: http://devmaster.net…me-development/ So it seems you guys are not the only ones having this issue with these tutorials.)

Unfortunately I don’t have any more suggestions. I don’t use SDL myself, so this goes beyond what I can guess at.

0
101 Dec 27, 2012 at 01:29

I got it to work, the problem was my GPU driver, i have a ATI HD4890 and the 4000 series is only supported up to version 12.6 of Catalyst control center and i had 12.10 running, so i installed an the older version (12.6) which is compatible with my card and it ran just fine.