# SDL runtime problem

**URL:** <https://discourse.libsdl.org/t/sdl-runtime-problem/9072>\
**Category:** SDL Development\
**Created:** [July 21, 2003, 8:18pm UTC](https://discourse.libsdl.org/t/sdl-runtime-problem/9072 "2003-07-21T20:18:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke\_Bailey](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/l/b5e925/32.png) [@Luke\_Bailey](https://discourse.libsdl.org/u/Luke_Bailey)\
**Post date:** [July 21, 2003, 8:18pm UTC](https://discourse.libsdl.org/t/sdl-runtime-problem/9072/1 "2003-07-21T20:18:05Z")

</div>

Hello,  
I’m new to SDL programming. Recently, the mac sprite library  
SpriteWorld was ported to SDL and I switched to the SDL version. I’m  
having some problems with the SDL portion of it. After discussing it  
with a member of the SW list, he suggested I go here.

The problem lies with loading image files using SDL\_Image. IMG\_Load  
fails to create a SDL Surface.

Here’s the function progression.  
SWLoadTilesFromSingleFileXY \<-- Sprite World Function  
IMG\_Load  
IMG\_LoadTyped\_RW

At this point it enters a for loop to detect the type of image. If  
successful, it should return an SDL Surface. However, it goes  
completely through the loop and hits this function.  
IMG\_SetError(“Unsupported image format”).

I’m running a Power Mac using OS X. My complier is CodeWarrior 8.  
As for any libraries I’m using:  
SDL - I complied the provided Carbon Debug Libraries  
SDL\_Image - Compiled Source code using CW 8 and told it to make a  
library

Note: I am aware of the OS X dev. binaries. I however need Carbon  
libraries, not Cocoa frameworks.

Luke Bailey

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [July 21, 2003, 10:37pm UTC](https://discourse.libsdl.org/t/sdl-runtime-problem/9072/2 "2003-07-21T22:37:01Z")

</div>

> Hello,  
> I’m new to SDL programming. Recently, the mac sprite library  
> SpriteWorld was ported to SDL and I switched to the SDL version. I’m  
> having some problems with the SDL portion of it. After discussing it  
> with a member of the SW list, he suggested I go here.

> The problem lies with loading image files using SDL\_Image. IMG\_Load  
> fails to create a SDL Surface.

> Here’s the function progression.  
> SWLoadTilesFromSingleFileXY ← Sprite World Function  
> IMG\_Load  
> IMG\_LoadTyped\_RW

> At this point it enters a for loop to detect the type of image. If  
> successful, it should return an SDL Surface. However, it goes  
> completely through the loop and hits this function.  
> IMG\_SetError(“Unsupported image format”).

> I’m running a Power Mac using OS X. My complier is CodeWarrior 8.  
> As for any libraries I’m using:  
> SDL - I complied the provided Carbon Debug Libraries  
> SDL\_Image - Compiled Source code using CW 8 and told it to make a  
> library

It sounds like when you built SDL\_image with CW 8, you didn’t add  
support for whatever image format you’re using. You need to #define  
some constants and link with the appropriate libraries for the format  
you are trying to load. Look at the source files for the individual  
formats for details.

See ya,  
-Sam Lantinga, Software Engineer, Blizzard Entertainment
