Mac C++ header that includes directory in xcode

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
 

lloyddean

macrumors 65816
May 10, 2009
1,002
16
Des Moines, WA
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.
 

Sander

macrumors 6502
Apr 24, 2008
480
7
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".
 

lucasvickers

macrumors newbie
Original poster
Nov 21, 2009
4
0
I suppose the alternative is to not use such general names for header files.
thanks for the input
 

lucasvickers

macrumors newbie
Original poster
Nov 21, 2009
4
0
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.
 

iShellac

macrumors newbie
May 28, 2010
3
0
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.
 

Similar threads

  • wise-net-cat
0
Replies
0
Views
540
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.