I Need help with SDL_image.h

LidLad
Unregistered
 
Post: #1
I just started (trying) to use SDL, and I am not having to much success as of yet because It's very hard to find information on using SDL with OSX, another big part of my problem is I am super-new to Xcode.
I have one really basic quesion, for now. I have installed the necessary SDL and SDL_image packages and they are in my /Library/Frameworks, but whenever i try to compile a very basic app. just to display a bitmap it tells me "error:SDL_image.h: No such file or directory." I know this is a really basic fix and I really appreciate all of your help.
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #2
#include "SDL_image/SDL_image.h"

replace include by import if you're using Cocoa/Obj-C

"When you dream, there are no rules..."
Quote this message in a reply
LidLad
Unregistered
 
Post: #3
Thanks
I just did that and i'm not getting that error anymore, you are awesome. But I am now getting the error: "Undefined symbols: Img_Load", what is up with this? I read another post and they said something about not forgetting to include the SDLImage framework, but isn't that just "SDL_image/SDL_image.h"?
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #4
No, not the same. Your app needs to link to the framework, so you'll need to add it to you Xcode project. Also, make sure the frameworks are actually copied to your built binary, you do this by going to the menu Project->New Build Phase->New Copy build phase

Drag the SDL frameworks in there, double click on the build phase and in the popup menu change it to Frameworks, leave the textfield empty.

"When you dream, there are no rules..."
Quote this message in a reply
LidLad
Unregistered
 
Post: #5
I did all that stuff, thanks for the advice, and now I don't get any errors, which is awesome. But all I'm getting is a blank window, but somehow it's not finding the file. Is there some special way that you have to link an image, I've tried putting it in the project folder and putting it in the resources folder in project builder? I know I'm missing something....
Quote this message in a reply
Member
Posts: 168
Joined: 2004.10
Post: #6
Try in the build folder that has the app in it. SDL looks there by default.
Quote this message in a reply
LidLad
Unregistered
 
Post: #7
I appreciate the reply but, hmm.. I put it in /chris/myProgram/build/ and various other places, but I'm still getting the same result, blank window and no tick.bmp. Here's the code, the relevant code (I think) just in case something's wrong there:

Code:
    int x_pos = 10;
    int y_pos = 10;

    image = IMG_Load("tick.bmp");
    if (image==NULL){
        printf("Image not found.\n");
    }

    // Draws the image on the screen:
    SDL_Rect rcDest = { x_pos, y_pos, 0, 0 };
    SDL_BlitSurface ( image, NULL, screen, &rcDest );
    SDL_FreeSurface ( image );
Quote this message in a reply
Member
Posts: 168
Joined: 2004.10
Post: #8
Try making sure the graphic is actually in the folder of which the built app is in, not just the build folder, and then double clicking the app, rather than running it via Xcode.
Quote this message in a reply
LidLad
Unregistered
 
Post: #9
thanks to everyone i got it all working just right. You guys are all great.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Trouble using SDL_image with XCode 3.2.3 Snow Leopard code4fun 1 4,262 Sep 22, 2010 10:47 PM
Last Post: OneSadCookie
  SDL_image and bmp loading Duane 13 8,370 Dec 21, 2009 09:14 AM
Last Post: Skorche
  Installing SDL_image & SDL_mixer bronxbomber92 8 5,540 Oct 14, 2006 09:39 PM
Last Post: szymczyk
  SDL_image + libpng + Panther = version mismatch BobbyWatson 2 4,032 Oct 23, 2005 03:55 AM
Last Post: BobbyWatson
  SDL_image errors mevdev 7 4,520 Sep 17, 2005 10:01 AM
Last Post: sealfin