STLport, boost & undefined symbols in Xcode
STLport, boost & undefined symbols in Xcode
- Subject: STLport, boost & undefined symbols in Xcode
- From: GoochRules! <email@hidden>
- Date: Mon, 2 Feb 2004 21:18:38 -0700
Greetings,
I have installed STLport-4.6 and boost from cvs. I also have this
simple program:
#include <boost/thread/thread.hpp>
#include <iostream>
void thread_func() {
using std::cout;
using std::endl;
cout << "thread_func - enter" << endl;
cout << "thread_func - exit" << endl;
}
class thread_obj {
public:
void operator()() {
using std::cout;
using std::endl;
cout << "thread_obj::operator() - enter" << endl;
thread_func();
cout << "thread_obj::operator() - exit" << endl;
}
};
int main(int argc, char* argv[]) {
thread_obj data;
boost::thread myThread(data);
myThread.join();
boost::thread myOtherThread(thread_func);
myOtherThread.join();
return 0;
}
Compiling it from Terminal using 'g++ -lboost_thread [-lstlport_gcc]
main.cpp' succeeds, and the program executes as expected.
Compiling it from Xcode (as a 'BSD Shell Tool'-type target) produces
undefined symbol errors.
First, without -lstlport_gcc specified in 'Other Linker Flags':
ld: Undefined symbols:
__ZN4_STL12__node_allocILb1ELi0EE11_M_allocateEm
__ZN4_STL12__node_allocILb1ELi0EE13_M_deallocateEPvm
__ZN4_STL4coutE
__ZN4_STL8ios_base16_M_throw_failureEv
__ZN4_STL8ios_base4InitC1Ev
__ZN4_STL8ios_base4InitD1Ev
__ZN4_STL8ios_base9_Loc_initC1Ev
__ZN4_STL8ios_base9_Loc_initD1Ev
__ZN5boost6threadC1ERKNS_9function0IvN4_STL9allocatorINS_13function_base
EEEEE
Second, with -lstlport_gcc specified in 'Other Linker Flags':
ld: Undefined symbols:
__ZN5boost6threadC1ERKNS_9function0IvN4_STL9allocatorINS_13function_base
EEEEE
If I turn on 'Zero Link', the link stage succeeds (as I thought it
would), but execution fails differently than expected: this time I get
the error:
ZeroLink: unknown symbol '__ZN4_STL4coutE'
test has exited due to signal 6 (SIGABRT).
This happens whether or not -lstlport_gcc is specified.
On the one hand it looks like a stl problem because of all the
undefined symbols therefrom, but for the same reason boost can be
blamed. But the fact that I can compile my example program from
terminal tells me its a problem with Xcode (or my configuration
thereof).
So, any hints on what Xcode settings to look at, or things to look for
when building STLport (with its own iostreams) or boost for 10.3, are
greatly appreciated.
Matthew Peltzer
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.