tttnl at October 3rd, 2012 12:16 — #1
Hello everyone, i am trying to learn C++ game development with this tutorial:
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:
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
ericpolman900 at October 3rd, 2012 13:09 — #2
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.
reedbeta at October 3rd, 2012 15:14 — #3
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.
ericpolman900 at October 4th, 2012 14:33 — #4
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?
reedbeta at October 4th, 2012 14:47 — #5
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.
tttnl at December 26th, 2012 20:29 — #6
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.