Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lucasvickers

macrumors newbie
Original poster
Nov 21, 2009
4
0
Hello,
I am attempting to pull curlpp (libcurl c++ wrapper) into an xcode project.

The library has include files such as:
#include <curlpp/Easy.hpp>

Which brings me to two questions.
1 - Why would someone put the curlpp/ in the include?
2 - How do I get this to work in xcode? I am able to pull the files in and I put them in a group called "curlpp", add them to the compiler search path, but when I attempt to build the curlpp/ is causing errors.

Thanks,
Lucas
 
It's likely its developer means for it to sit along side the CURL headers which on Mac OS X are at /usr/include/curl/curl.h. Being that this is a system header include path it is accessed with '#include <curl/curl.h>'.

I don't recommend placing the 'curlpp' headers in the systems '/usr/include'. Instead if you're finding yourself using a good number of *nix libraries I'd suggest placing then in a common location on your system and then pointing at them using "Source Trees" panel of Xcodes Preferences.

For instance I use Boost in some projects but like to use MacPorts which has a working Boost port. So I simply add an entry to the "Source Tree" panel.

"Setting name" 'BoostHeaders', "Display Name" 'Boost Headers' and "Path" as '/opt/local/usr/include'.

This carries across all Xcode projects with no need for me to set it up for each project.

Check out the using Xcode Source Trees.
 
1 - Why would someone put the curlpp/ in the include?

This is a form of namespacing. Suppose you use lots of libraries in your project, chances are that a file called "utilities.h" or "types.h" exists multiple times. If you add all directories for these libraries to your include path, the compiler will simply pick the first one it finds. If you only add the top level directories, you can discriminate between "onelibrary/types.h" and "anotherlibrary/types.h".
 
I suppose the alternative is to not use such general names for header files.
thanks for the input
 
Could you please explain how you got it working? I'm struggling with the same thing. Have tried creating a Source Tree to no effect.

This was a while ago I can't remember. I believe I add the curlpp and curlutils files into the 10.6 SDK for apple. All in all if you get the include paths specified in the project correctly it should work fine.
 
I figured it out. Source Trees weren't the solution at all for me.

I copied the curlpp and utilspp directories into my /usr/local/include directory, then went into my project build settings and added /usr/local/include to my Header Search Paths (making sure to check Recursive). Compiled fine after that.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.