Jump to content
  • Advertisement
Sign in to follow this  
rogierpennink

IMG_Load - fails in debugger, succeeds without [SOLVED]

This topic is 4456 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

[EDIT]: Solved, it all boiled down to a simple, stupid, wrong working directory Original Message: ------------------------------------------------------------------------------- Hey, I think the topic title must have explained a lot already, but I'll re-explain anyway [grin]. Somehow, when I run the debug version with the Visual C++ debugger, the IMG_Load function from SDL_image won't work. All the surfaces that are loaded with it remain NULL pointers. The strange thing is, however, that as soon as I simply open the folder in which the .exe is located and double click on the application from there, it works fine, no problems at all. All images are displayed exactly as they should as well. Is there anyone who has a clue about what might be the underlying cause of this (I don't know my IDE well enough, it seems)? Normally I wouldn't bother debugging, but there's something else I need to debug in the application, and this image loading thing in debug mode prevents that. Underneath is my image loading method:
SDL_Surface * LoadImage ( std::string filename )
{
	SDL_Surface *temp1 = NULL;
	SDL_Surface *temp2 = NULL;

	temp1 = IMG_Load ( filename.c_str() );
	
	if ( temp1 != NULL )
	{
		temp2 = SDL_DisplayFormat ( temp1 );
		SDL_FreeSurface ( temp1 );
	}

	return temp2;
}



Thanks in advance for any help. - Rogier [Edited by - rogierpennink on October 1, 2006 2:33:44 PM]

Share this post


Link to post
Share on other sites
Advertisement
On your suggestion I explicitly set the working directory to the Debug folder of the project, however, the images still won't load when debugging. (The images are in "media/images/", relative to the debug folder). Does the debugger require me to put all image files in the same directory or something?

Edit: I actually did that and it didn't work either :(

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!