在XCode 4.5.2 c ++项目中链接boost序列化静态库

时间:2013-02-01 13:25:19

标签: c++ xcode boost

我正在Mac OSX 10.8(Mountain Lion)上构建应用程序,我收到了与Boost库(serialisation.a)相关的链接错误。我在同一个项目中使用其他Boost二进制文件并且它们没有抛出任何问题,所以我非常有信心我已经正确构建了库(我选择为Darwin工具集构建整个库集) 。出于同样的原因,我有理由相信我的链接器路径设置正确。我知道这个列表中没有很多Mac开发人员,但我想知道是否有人可以提供任何建议。该项目由XCode 4.5.2处理,并使用GCC 4.2编译器。以下是构建的输出(我只包含了第一个错误 - 所有其余的都是主题的变体,所有都引用了Boost :: archive或Boost :: serialization(两者都包含在Boost序列化中) .a静态库文件)。

Ld /Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Products/Debug/SurfaceReader.app/Contents/MacOS/SurfaceReader normal x86_64
    cd /Users/tim/Developer/SurfaceReader
    setenv MACOSX_DEPLOYMENT_TARGET 10.8
    /Applications/Xcode.app/Contents/Developer/usr/bin/llvm-g++-4.2 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Products/Debug -L/users/tim/developer/libraries/boost_1_50_0/lib -L/users/tim/developer/libraries/cryptopp561 -F/Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Products/Debug -filelist /Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Intermediates/SurfaceReader.build/Debug/SurfaceReader.build/Objects-normal/x86_64/SurfaceReader.LinkFileList -mmacosx-version-min=10.8 -L/Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_xrc-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_webview-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_qa-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_baseu_net-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_html-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_adv-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_osx_cocoau_core-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_baseu_xml-2.9.a /Users/tim/developer/libraries/wxwidgets-2.9.4/build-debug/lib/libwx_baseu-2.9.a -framework WebKit -lexpat -lwxregexu-2.9 -lwxtiff-2.9 -lwxjpeg-2.9 -lwxpng-2.9 -lz -lpthread -liconv -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -framework CoreMIDI -framework CoreAudio -framework Cocoa -lboost_filesystem -lboost_iostreams -lboost_serialization -lboost_system -lcryptopp -o /Users/tim/Library/Developer/Xcode/DerivedData/SurfaceReader-fwryryuvfvwihnglkuymbbjtxpac/Build/Products/Debug/SurfaceReader.app/Contents/MacOS/SurfaceReader

Undefined symbols for architecture x86_64:

  "boost::archive::basic_xml_iarchive<boost::archive::xml_wiarchive>::load_start(char const*)", referenced from:
      void boost::archive::basic_xml_iarchive<boost::archive::xml_wiarchive>::load_override<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >(boost::serialization::nvp<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > const&, int)in SurfaceFrame.o

1 个答案:

答案 0 :(得分:0)

Apple LLVM标准编译器4.2 - 语言 / C ++标准库设置从 libc ++(LLVM)更改为 libstdc ++(GNU) 为我解决了同样的情况。