Jump to content


Problem running a template from tutorial

debugging

5 replies to this topic

#1 TTTNL

    Member

  • Members
  • PipPip
  • 48 posts

Posted 03 October 2012 - 04:16 PM

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

#2 Eric Polman

    New Member

  • Members
  • Pip
  • 2 posts

Posted 03 October 2012 - 05:09 PM

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.

#3 Reedbeta

    DevMaster Staff

  • Administrators
  • 5308 posts
  • LocationSanta Clara, CA

Posted 03 October 2012 - 07:14 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#4 Eric Polman

    New Member

  • Members
  • Pip
  • 2 posts

Posted 04 October 2012 - 06:33 PM

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?

#5 Reedbeta

    DevMaster Staff

  • Administrators
  • 5308 posts
  • LocationSanta Clara, CA

Posted 04 October 2012 - 06:47 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#6 TTTNL

    Member

  • Members
  • PipPip
  • 48 posts

Posted 27 December 2012 - 01:29 AM

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users