I have a C ++ library referenced by an Objective-C ++ project. The library compiles on its own, and the Objective-C ++ project compiles until I create the first class from the library (using the object pointer). Before using the class from my library, I had links to stl string objects that did not cause problems.
I get the following errors:
Undefined symbols for architecture i386: "std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from: __verify_callback_c in *************.a(cxx_db.o) DbEnv::_stream_message_function(__db_env const*, char const*) in *************.a(cxx_env.o) DbEnv::_stream_error_function(__db_env const*, char const*, char const*) in *************.a(cxx_env.o) "std::basic_ios<char, std::char_traits<char> >::fail() const", referenced from: __verify_callback_c in *************.a(cxx_db.o) "std::ios_base::Init::Init()", referenced from: __static_initialization_and_destruction_0(int, int) in *************.a(cxx_db.o) __static_initialization_and_destruction_0(int, int) in *************.a(cxx_dbc.o) __static_initialization_and_destruction_0(int, int) in *************.a(cxx_dbt.o) __static_initialization_and_destruction_0(int, int) in *************.a(cxx_env.o) __static_initialization_and_destruction_0(int, int) in *************.a(cxx_mpool.o) __static_initialization_and_destruction_0(int, int) in *************.a(cxx_txn.o) __static_initialization_and_destruction_0(int, int) in *************.a(cxx_lock.o) ... "std::ios_base::Init::~Init()", referenced from: ___tcf_0 in *************.a(cxx_db.o) ___tcf_0 in *************.a(cxx_dbc.o) ___tcf_0 in *************.a(cxx_dbt.o) ___tcf_0 in *************.a(cxx_env.o) ___tcf_0 in *************.a(cxx_mpool.o) ___tcf_0 in *************.a(cxx_txn.o) ___tcf_0 in *************.a(cxx_lock.o) ... ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
So far, I have found that such errors can be caused by:
- The presence of a file type .m instead of .mm
- Creating a C ++ object in my Objective-C ++ without using a pointer
I assume this is some kind of cross-compilation error, but I don't know where to look. Ideas about what it could be?
EDIT:
Build Settings: C++ Standard Library = libc++ C++ Language Dialect = c++0x
This is in my top level project. The hidden library also uses them (it also refers to an external library, and the header path is no longer found when added to my main project - I had to add it to my main project settings).
Edit 2: Here is the build result:
Ld / Users / user / Library / Developer / Xcode / DerivedData / BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsdturoklb / Build / Products / Debug-iphonesimulator / BerkeleyDBHelloWorldSimulator.app / BerkeleyDBHelloWorldSimulator normal i386 cd / Users / username / Documents / Projects / tests / BerkeleyDBHelloWorldSimulator setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer / usr / bin / clang ++ -arch i386 -isysroot / Developer / Platforms / iPhoneSimulator.platform / Developer / SDKs / iPhoneSimulator5.0.sdk -L / Users / user / library / developer / Xcode / DerivedData / BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsild Products / Debug-iphonesimulator -F / Users / User / Library / Developer / Xcode / Derive dData / BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsdturoklb / Build / Products / Debug-iphonesimulator file / Users / username / Library / Developer / Xcode / DerivedData / BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsdturoklb / Build / Intermediates / BerkeleyDBHelloWorldSimulator.build / Debug-iphonesimulator / BerkeleyDBHelloWorldSimulator.build / Objects-normal /i386/BerkeleyDBHelloWorldSimulator.LinkFileList -mmacosx-version-min = 10.6 -Xlinker -objc_abi_version -Xlinker 2 -stdlib = lib ++ -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_CLIRE_CLINDREIREDQUIREDIQUIRE_LINER DerivedData / BerkeleyDBHelloWorldSimulator-b gnkrqnronvtkoaongfsdturoklb / Build / Products / Debug-iphonesimulator / libBerkeleyDB.a -framework UIKit -framework Foundation -framework CoreGraphics -o / Users / user / Library / Derived Xcode Data / BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsdturoklb / Build / Products / Debug-iphonesimulator / BerkeleyDBHelloWorldSimulator.app / BerkeleyDBHelloWorldSimulator