Search code examples
c++xcodelinkerjsoncpp

Integrating jsoncpp by including amalgamated source in Xcode


I'm struggling with a Linker error in Xcode. I've created the amalgamated source, added the jsoncpp.cpp as a source file to my project, I've set the header search path to jsoncpp-master/dist and use

#include "json/json.h"
#include "json/json-forwards.h"

as described at https://github.com/open-source-parsers/jsoncpp. Still, I'm getting an undefined symbols error:

 Undefined symbols for architecture x86_64:
   "output(Json::Value)", referenced from:
      _main in main.o
 ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution

  • I found that it works if json/json.h, json/json-forward.h and jsoncpp.cpp are copied to the project directory. jsoncpp.cpp is added as a source file and json/json.h as a header. However, NO additional header search paths are set.