Jump to content
  • Advertisement
Sign in to follow this  
Olrich

Bitmaps crash SDL + VC++

This topic is 4923 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 have a question relating to the use of Bitmap images, with SDL using Visual C++.NET. I am using the standard practice of loading them to a surface, and blitting that surface to the screen. Whenever I try to run the application from VC++, it instantly crashes, and when I debug it, there appears to no error, the application is simply unable to load the bitmap. However, if I go to the Debug folder in Windows Explorer and run it from there, it works just fine. I only have this problem in SDL applications that use bitmaps. Now, I have been just running my applications from the debug folder from some time now and it had worked just fine. But now I'm in a situation where I need to debug the code later in my program, but I am unable to because it always crashes from VC++. Does anyone know why it crashes when I run it from VC++ and what I can do to fix it? All help will be greatly appreciated. Thanks again.

Share this post


Link to post
Share on other sites
Advertisement
Few questions:

1. Where are your images located at?
2. What style of path do you use to load the images (relative/absolute)?
3. Do you have error checking in your program to where if it cannot find the BMP on load it will tell you and exit?

Also if you could provide some code perhaps, that might make it a bit easier to determine what is wrong. One thing though is that it should work in VC.Net [wink]

Share this post


Link to post
Share on other sites
ok, the thing is this, but your bitmaps in the folder above the debug folder and try to run it from VC and you'll see something magic :)

VC sets the program working directory to the directory above the debug/release ones wich is actually quite sane since then both debug and release versions share the same working directory and hence same files and other external resources that are just loaded from the current directory instead of from a hard-coded path.

Share this post


Link to post
Share on other sites
Well, in a very short amount of time, I have managed to greatly compound this problem. To first answer Drew's questions, I store them in the Debug folder, along with the EXE. I load like so SDL_LoadBMP("ball.bmp"). I tried moving the images up a folder like DigitalDelusion suggested but that gave me no success as well.

There was no error checking implemented before on the bitmaps, so I tried doing this, but then the program started crashing even before it tried to load the bitmaps. When I debugged this, it said "No source code available" and showed me the dissasemblies. In the error box, it mentioned ntdll.dll.

I removed the new bits of code, and returned to the program to its previous state, but now it won't even compile at all. I get the following error:
Bounce fatal error LNK1201: error writing to program database 'c:\Documents and Settings\Chris Bartak\My Documents\Visual Studio Projects\Bounce\Debug\Bounce.pdb'; check for insufficient disk space, invalid path, or insufficient privilege

EDIT: Nevermind, I'm a loser. DigitalDelusion was completely right. It just happened that something else is also making my program crash from VC++. Its a very similar problem, this time with my fonts folder. Thanks a lot, its working just fine now.

Share this post


Link to post
Share on other sites
Thanks a lot, all I had to do was close VC, delete that pdb file, move my bitmaps and my fonts folder(idiocy on my part for forgetting that) and everything worked great. Thanks again man.

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!