Search code examples
c++xcodemakefilecurlpp

Can't use curlpp with Xcode even though library is included


I am trying to use curlpp in my Xcode c++ project, but even though I added the library to the target in the project settings, I'm told "file not found" for the line

#include <curlpp/cURLpp.hpp>

I probably did something wrong, but I'm not sure what. I followed some instuctions together with another stackoverflow question (not long). Here are my exact steps:

  1. I downloaded the source from Google Code
  2. I unzipped it etc., then I ran ./configure --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info --without-boost
  3. I changed a line in the Makefile: SUBDIRS = src include examples doc to SUBDIRS = src include doc (removed "examples")
  4. I ran make
  5. I ran sudo make install

Everything ran without problems. So I wanted to include the library:

  1. Targets -> Build Phases -> Link Binary with Libraries -> "+" -> Add Other
  2. If I understood correctly, the lib must be in /usr/local
  3. I found libcurlpp.0.dylib in /usr/local/lib
  4. It's a hidden folder, so I copied it to the project directory and added it to the project
  5. I hit compile.
  6. Xcode told me 'curlpp/cURLpp.hpp' file not found

Any help is greatly appreciated! I'm still on the switch from ruby/javascript/python to c++! :)


Solution

  • It looks like you are linking ok, but if Xcode can't find the header it means you don't have the header search path set up properly. Go to Build Settings --> Header Search Path and add the path to your header. Since you are including 'curlpp/cURLpp.hpp' you path has to be the folder containing the folder 'curlpp'.