我有跨平台解决方案,它是为Windows,Linux而成功构建的,但是在Mac OS X上构建时我有这样的问题:
Undefined symbols for architecture x86_64:
"qx::syb::DataType<boost::shared_ptr<qx::DistributedObject>, void>::DataType()", referenced from:
qx::syb::AbsDynInfo const& qx::syb::dynInfo<boost::shared_ptr<qx::DistributedObject> >()in ThemeKit.cpp.o
qx::syb::AbsDynInfo const& qx::syb::dynInfo<boost::shared_ptr<qx::DistributedObject> >()in libguiserver.a(MemUtils.cpp.o)
"qx::syb::DataType<boost::shared_ptr<qx::aum::Color>, void>::DataType()", referenced from:
qx::syb::AbsDynInfo const& qx::syb::dynInfo<boost::shared_ptr<qx::aum::Color> >()in ThemeKit.cpp.o
"qx::syb::DataType<boost::shared_ptr<qx::ffm::Field>, void>::DataType()", referenced from:
qx::syb::AbsDynInfo const& qx::syb::dynInfo<boost::shared_ptr<qx::ffm::Field> >()in libguiserver.a(FormConverter.cpp.o)
"qx::syb::DataType<boost::shared_ptr<qx::lfm::EventType>, void>::DataType()", referenced from:
qx::syb::AbsDynInfo const& qx::syb::dynInfo<boost::shared_ptr<qx::lfm::EventType> >()in libguiserver.a(FormConverter.cpp.o)
"qx::syb::DataType<boost::shared_ptr<qx::lfm::ParsedExpression>, void>::DataType()", referenced from:
qx::syb::AbsDynInfo const& qx::syb::dynInfo<boost::shared_ptr<qx::lfm::ParsedExpression> >()in libguiserver.a(FormConverter.cpp.o)
ld: symbol(s) not found for architecture x86_64
我检查了链接器行,它包含了包含此类符号定义的目标文件。
例如:
bash-3.2$ nm -arch x86_64 -U instance*.o | c++filt | grep -i "qx::syb::DataType<boost::shared_ptr<qx::DistributedObject>, void>::DataType()"
00000000001e6e68 S qx::syb::DataType<boost::shared_ptr<qx::DistributedObject>, void>::DataType()
0000000000092e48 S qx::syb::DataType<boost::shared_ptr<qx::DistributedObject>, void>::DataType()
000000000009b170 S qx::syb::DataType<boost::shared_ptr<qx::DistributedObject>, void>::DataType()
它定义了几次,但另一个"qx::syb::DataType<boost::shared_ptr<qx::aum::Color>, void>::DataType()"
只定义了一次而且也被错过了。所以这不应该成为一个问题。
我有最新的可能环境
Mac OS X version:Darwin mac.qx 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
IDE: XCode:4.2
Compiler:gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)