iOS Compile Error: Undefined Symbols std::__1::

Q: I am receiving the following compile errors when I add PDFNet to my project:

Undefined symbols for architecture i386:

“std::__1::basic_streambuf<char, std::__1::char_traits >::seekoff(long long, std::__1::ios_base::seekdir, unsigned int)”, referenced from:

l36403 in PDFNet(all-obfuscated.o)

“std::__1::basic_streambuf<char, std::__1::char_traits >::seekpos(std::__1::fpos<__mbstate_t>, unsigned int)”, referenced from:

l36403 in PDFNet(all-obfuscated.o)

“std::__1::basic_streambuf<wchar_t, std::__1::char_traits<wchar_t> >::showmanyc()”, referenced from:

l36335 in PDFNet(all-obfuscated.o)

etc. How can I fix this error?

A:

The problem is that the project is set to use the GNU implementation of the standard library (stdc++), and PDFNet is expecting the LLVM implementation of the standard library (libc++). To fix this problem, please be sure of two things:

  1. In your project’s settings, that the standard library is set to libc++.
  2. If you are deploying for iOS 7+, then add at least one .mm or .cpp to your project.