When trying to link with a dynamic library I built with Xcode 6.3.2, all of my calls to class functions that have parameters of std::string refuse to link:
Undefined symbols for architecture x86_64:
“MyClass::Bogus(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)”,…
The dylib’s .h file IS being included, and the public class member is prototyped as:
int Bogus(std::string& aStringRef, bool verbose);
INTERESTINGLY, if I change the type of that first std::string parameter to long (and call it with a long as the first parameter), there is no link error. So I know I am definitely linking with the dylib I built.
For my dylib, the Apple LLVM 6.1 C++ standard library is set to the default (libstdc++).
The code where I am making the call from is itself a .dylib, and is being compiled and linked not from Xcode, but entirely from a makefile. The version of c++ used to compile from that makefile is:
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
One thing that seems suspicious to me is that the calling code is compiled using "-std=c++1y”, which may be using a standard library for C++14. Could there be a conflict between the standard library being linked for the calling program with the one I selected for building the dylib? (my dylib’s code is being compiled with compiler dialect = GNU++98)