Basic compiling questions...

Posts: 321
Joined: 2004.10
Post: #1
Ok, got some code (not mine) I'm porting to Xcode and have this line:

#include <SDL/SDL_image.h>

which returns

error SDL/SDL_image.h: no such file or directory

Is the "SDL" above a directory? If so, is it relative and from what?

In frustration, I go to spotlight and search for SDL_image.h which returns
a long path which I stupidly stick into the offending #include.

#include </Library/Frameworks/SDL_image.framework/Versions/A/Headers/SDL_image.h>

Everything compiles and runs fine. Now I realize that this is *bad* to put
a hardcoded path into my program. But what would be a more acceptable
Quote this message in a reply
Posts: 133
Joined: 2008.05
Post: #2
In most cases, it's #include<FrameworkName/Headerfile>

So, try SDL_image/SDL_image.h or just SDL_image.h and make sure you've included the framework.
Quote this message in a reply
Posts: 321
Joined: 2004.10
Post: #3
Well, that was too easy Smile Thanks. Can't say I've ever come across that before.

Say, just for discussion sake, if frameworks were out of the equation, would the
best approach then be to stick that long path name in the Header Search Path
of the Xcode's project?
Quote this message in a reply
Posts: 370
Joined: 2002.04
Post: #4
If it's not in a framework, the header ought to go in /usr/include or /usr/local/include or some path already in the search path - that's the whole point. If it's not, sure you could add it to the list...

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Basic questions about rigid body physics hangt5 15 9,277 Jul 7, 2005 04:18 PM
Last Post: hangt5