Hi,
I think my question is pretty easy to answer. Well, I used to play with
some code on Linux and that was pretty easy. If I had to use a xyz lib
I used to download it in its tar.gz form, do the usual ./configure and
make + make install and the lib was there, usable. On OSX its not that
simple. Especially if you use Xcode. In command line environment I can
manage g++ find the correct header files and link against the correct
libs, but I cannot get this in Xcode. For widely used libs, such as SDL
or OpenGL, you can often find a pakaged framework to add to your
project, but for lib xyz made from the unknown linux geek in Singapore,
I really can't get it working in a project... For example, now I want
to use the expat library (instead of the xml lib from apple) and I
compiled it from sources, but I cannot use it in my projects.
I think the solution is pretty simple, anyway I couldn't find a good
tutorial/howto to do this.
Thanks, happy new year
Patrick Machielse - 29 Dec 2006 15:49 GMT
> If I had to use a xyz lib I used to download it in its tar.gz form, do the
> usual ./configure and make + make install and the lib was there, usable.
> On OSX its not that simple.
The ./configure, make, make install mantra works most of the time (if
the Makefile was built with Mac OS X in mind, and OS X awareness is
growing all the time).
> For example, now I want to use the expat library (instead of the xml lib
> from apple) and I compiled it from sources, but I cannot use it in my
> projects.
Your project/target's settings have a 'Search paths' section where you
can specify the usual comiler flags (-L, -I etc.). When you add libs to
your project via the Project -> Add to Project... menu item some of
these flags are set for you automatically. I agree that this process
doesn't always worrk exactly like you want, but when you open the build
window (command-b) you can inspect the complete invocation of gcc for
each source file. That should clear up what's wrong.
patrick
David Phillip Oster - 29 Dec 2006 16:22 GMT
> I think my question is pretty easy to answer. Well, I used to play with
> some code on Linux and that was pretty easy. If I had to use a xyz lib
[quoted text clipped - 13 lines]
>
> Thanks, happy new year
To get the compiled code:
Starting in the Finder, drag the compiled code into the frameworks
section of your project window.
To get the headers: easiest is to drag them into your project window,
too. (You can create a "group" to keep them out of your way.)
You can instead, open the project's Get Info window, in the Build tab,
click on "Header Search Paths", press the Edit button, press the [+]
button, and add the path to the headers.
expat isn't already in /usr/lib, but libxml, libxslt, and libexslt are.
Gotch@ - 30 Dec 2006 13:15 GMT
Reading your reply I noticed that you said:
> To get the compiled code:
> Starting in the Finder, drag the compiled code into the frameworks
> section of your project window.
> To get the headers: easiest is to drag them into your project window,
> too. (You can create a "group" to keep them out of your way.)
but I ask, using this method (an it tempts me a lot coz I'm so lazy)
are the above files copied or just referenced?
David Phillip Oster - 30 Dec 2006 17:09 GMT
> Reading your reply I noticed that you said:
>
[quoted text clipped - 7 lines]
> but I ask, using this method (an it tempts me a lot coz I'm so lazy)
> are the above files copied or just referenced?
If you drag .h files into your project window, they are referenced, not
copied, but, with some versions of project file, if you look in the
Targets section, and hit the disclosure triangle under YOUR target,
you'll see a linked set of gray boxes. Depending on the history of the
stationary that you started with, dragging .h files into the project may
have added them to a Copy Files stage, which would cause the .h files to
be copied into your application when you build your application. If your
project has this problem, just select and delete the .h files from the
Copy Files stage.