SDL basic program error

Hey, I tried making the basic SDL program where I make a window and display an image onto it. When I built the program, the window popped up, but no image. I placed the image in the same file as the Xcode project (I’m using a mac) and named it correctly. After it didn’t work I copy pasted the exact program from the tutorial I was using, and the same results: window but no image. Any idea as to what I did wrong?

Hi

Have you tried printing the value of SDL_GetError() to see why it
fails to load? Are you using bitmaps, or another format with
SDL_Image?On Sunday, November 22, 2009, jesseoffy wrote:

Any idea as to what I did wrong?

I’m using the BMP file. Where do I place SDL_GetError()? I’m quite new to sdl still. This is the first thing I have learned.

Hi.

SDL_GetError() returns a C string describing why the last SDL function
returned an error. You can print it to the console if your app is
using one, or you could create a message box to display the error. I’m
not too familiar with macs but you should be able to rig your program
to run with a console, so you can use printf() for C or std::cout from
C++ to view the value of SDL_GetError().On Sun, Nov 22, 2009 at 3:17 PM, jesseoffy wrote:

I’m using the BMP file. Where do I place SDL_GetError()? I’m quite new to
sdl still. This is the first thing I have learned.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hey, I tried making the basic SDL program where I make a window and display
an image onto it. When I built the program, the window popped up, but no
image. I placed the image in the same file as the Xcode project (I’m using a
mac) and named it correctly. After it didn’t work I copy pasted the exact
program from the tutorial I was using, and the same results: window but no
image. Any idea as to what I did wrong?

It sounds like you don’t have the correct path to the image. The
working directory of your SDL app (the .app file) is by default set to
its parent. So for example if you put the image in
ProjectFolder/build/Debug where the .app file gets created you would
then be able to reference the file like IMG_Load(“filename”).

Todd Steinackle
http://www.noquarterarcade.com/On Sun, Nov 22, 2009 at 9:31 AM, jesseoffy wrote:


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Oh, so theimagegoeswhere the app is created, not in the xcodeproject folder? I’ll try that