0

I'm new to Objective-C and Xcode.

I'm trying to parse a YAML file from my .mm file. I decided to use the yaml-cpp library to accomplish this task.

I downloaded the source and added all the header files to my project. I can include the yaml.h header file in my .mm file and it successfully builds.

#include <yaml-cpp/yaml.h>
...

When I try to execute the sample code, with the following statement:

std::ifstream yamlReader("vmap3_styleattrs.yaml");
YAML::Parser yamlParser(yamlReader);

I get the following error:

Undefined symbols for architecture x86_64:
  "YAML::Parser::Parser(std::__1::basic_istream<char, std::__1::char_traits<char> >&)", referenced from:
    -[StyleSheetTests testGeoCSSTestAPIPrototype] in StyleSheetTests.o
  "YAML::Parser::~Parser()", referenced from:
    -[StyleSheetTests testGeoCSSTestAPIPrototype] in StyleSheetTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The funny thing is, it compiled the first time, but every successive attempt since then, the build has failed with the message above.

I'm wondering whether this question is related to my situation, although I'm not sure.

I'd appreciate any inputs.

Community
  • 1
  • 1
Srini
  • 1,626
  • 2
  • 15
  • 25
  • What did you do with the source files? – user253751 Jun 01 '16 at 01:39
  • @immibis, I physically copied the source files to my project directory and referenced them in my source code. For e.g. `#include` doesn't throw an error, as I've copied the *yaml.h* header file to the *yaml-cpp* folder in my project directory. – Srini Jun 01 '16 at 17:30

1 Answers1

-1

This screenshot illustrates the answer outlined below:

I think you can fix through this method.

Project Setting -> Build Settings -> Apple LLVM 7.0 Language - C++ -> C++ Standard Library And Change libc++ ( LLVM C++ standard library with C++11 support) to libstdc++ (GNU C++ standard library )

Srini
  • 1,626
  • 2
  • 15
  • 25
frogxy
  • 19
  • 6