Note that there are some explanatory texts on larger screens.

plurals
  1. POErrors when cross compiling C++/Objective-C++
    text
    copied!<p>I have a C++ library being referenced by an Objective-C++ project. The library compiles fine on its own and the Objective-C++ project compiles fine until I instantiate the first class from the library (using an object pointer). Before using the class from my library I had references to stl <code>string</code> objects that didn't cause problems.</p> <p>I'm getting the following errors:</p> <pre><code>Undefined symbols for architecture i386: "std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, 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&lt;char, std::char_traits&lt;char&gt; &gt;::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) </code></pre> <p>So far I've found that errors like these can be caused by:</p> <ol> <li>Having a file type of .m instead of .mm</li> <li>Creating a C++ object in my Objective-C++ without using a pointer</li> </ol> <p>I'm assuming it's some sort of cross-compile error, but I don't know where to look. Ideas on what it could be?</p> <p>EDIT:</p> <pre><code>Build Settings: C++ Standard Library = libc++ C++ Language Dialect = c++0x </code></pre> <p>These are in my top-level project. The contained library is using these as well (it references an outside library as well, and the header path was no longer found when added it to my main project - I had to add it to my main project settings).</p> <p>Edit 2: Here is the build step that fails:</p> <p>Ld /Users/<em>user</em>/Library/Developer/Xcode/DerivedData/BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsdturoklb/Build/Products/Debug-iphonesimulator/BerkeleyDBHelloWorldSimulator.app/BerkeleyDBHelloWorldSimulator normal i386 cd /Users/<em>user</em>/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/<em>user</em>/Library/Developer/Xcode/DerivedData/BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsdturoklb/Build/Products/Debug-iphonesimulator -F/Users/<em>user</em>/Library/Developer/Xcode/DerivedData/BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsdturoklb/Build/Products/Debug-iphonesimulator -filelist /Users/<em>user</em>/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=libc++ -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -lstdc++ /Users/<em>user</em>/Library/Developer/Xcode/DerivedData/BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsdturoklb/Build/Products/Debug-iphonesimulator/libBerkeleyDB.a -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/<em>user</em>/Library/Developer/Xcode/DerivedData/BerkeleyDBHelloWorldSimulator-bgnkrqnronvtkoaongfsdturoklb/Build/Products/Debug-iphonesimulator/BerkeleyDBHelloWorldSimulator.app/BerkeleyDBHelloWorldSimulator</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload