Reputation: 63264
I'm trying to use a sample program for the gloox
library (a XMPP client library for C++) that I'll eventually integrate into (among others) an iOS app. An obvious (yet frustrating difficult) step in achieving this is to use the C++ code in Xcode (typically with the clang compiler).
How I compiled using G++
:
g++ -o bot bot.cpp -lgloox -lpthread
What I've tried in Xcode
:
Under my targets build settings:
Other C++ Flags
and added -lpthread
and -lgloox
, so in theory the required libraries are linked.Header Search Paths
and added /usr/include
and /usr/local/include
, both set to recursive.
The gloox headers are found in /usr/local/include
, so the header should theoretically be available.However, when I go to compile this abomination, I get these errors:
Can somebody help me make sense of these?
Edit: I've searched the internet extensively for this, to no avail.
Upvotes: 1
Views: 400
Reputation:
You will need to remove /usr/include
from your library search paths. It's already included by default, and trying to add it a second time can make it end up overriding some headers provided by the compiler, with unfortunate results.
The link errors you got when you did this look like the gloox library isn't being used at link time, so that's failing now. This is progress! — if you're getting to the link phase, compilation is now going just fine.
Go to your project settings (click the project name at the top of the left-hand column), go to the "Build Phases" tab, open up the "Link Binary With Libraries" phase, and click the + button. Then find libgloox.dylib
(probably in /usr/local/lib
) and add it.
Upvotes: 1