Problems reading pngs?

Hey all,

I’ve got a curious problem. I’ve been trying to help someone getting
my game running and I’m stumped.

The problem occurs when reading images.
I am using SDL and SDL_image. The image data is in .png files.

My system is Redhat 6.{0,1,bitsofotherstuff} including libpng-1.0.3-4
(libpng.so.2.1.0.3) which works fine.
His is SuSE 6.2, with upgraded libs like imlib, etc.

I have a section of code like so:

for ( i=0; i<NUMBER_SPRITES; i++ )
{
sprintf(filename, “%s/%s”, g->data_dir, SPRITE_FILENAME[i] );
if ( (SPRITE[i] = IMG_Load(filename)) == NULL )
{
printf(“ERROR: reading game data %s\n”, SPRITE_FILENAME[i]);
perror(SPRITE_FILENAME[i]);
exit(-1);
}
}

He gets the following message from the above code:
ERROR: reading missilecommand.png
missilecommand.png: Success

The perror() message would be from the fopen() in IMG_Load() (so the
file is being found and opened successfully).

So why would IMG_Load() be failing? He has libpng.so.2, what else
should I ask him to check?

cheers,
Julian.

So why would IMG_Load() be failing? He has libpng.so.2, what else
should I ask him to check?
Check config.log for SDL_image to verify PNG support is enabled (up to
a couple of months ago, you had to explicitly enable PNG support in
SDL_image with a configure flag; it wasn’t enabled by default).

HTH

Steve Madsen

So why would IMG_Load() be failing? He has libpng.so.2, what else
should I ask him to check?

SDL provides SDL_GetError() which returns a helpful error message.
I should have remembered that.

ho hum,

Julian.