2013-07-26 121 views
0

我想使用铿锵编译boost C++。为什么boost编译在clang失败?

./b2 --prefix=~/boost --includedir=~/boost/include --libdir=~/boost/lib toolset=clang cxxflags="-std=c++11 -stdlib=libc++ -isystem ~/libcxx/include/" linkflags="-stdlib=libc++ -L ~/libcxx/lib/" 

当我看到日志文件提示错误说

Undefined symbols for architecture x86_64: 
"boost::system::system_category()", referenced from: 
    __GLOBAL__I_a in exceptions.o 
"boost::system::generic_category()", referenced from: 
    __GLOBAL__I_a in exceptions.o 
    ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我的默认铛铛是-MP-3.3。任何人都可以请帮我弄清楚这个问题是什么。

+0

什么是平台?什么是Boost版本? –

+0

谢谢Igor R的评论。平台是什么意思(对不起)?其提升1.55。我有mac darwin内核版本12.4.0 – solti

+0

Boost 1.55不存在,也许你的意思是1.54。链接器无法找到什么符号? –

回答

1

在网络中搜索错误的原因后,我发现this解释关于编译与叮当的提升。我不知道为什么添加define = BOOST_SYSTEM_NO_DEPRECATED使它工作。请评论任何知道它为什么成功的人。然后,我可以编译没有错误,但我仍然看到一些警告,但它现在为我工作。

我使用的默认铛是(铛-MP-3.3)

$铛-v

铛3.3版本(标签/ RELEASE_33 /决赛) 目标:x86_64的 - 苹果darwin11.4.2 螺纹型号:posix

./bootstrap.sh --with-toolset=clang --without-libraries=mpi,python,graph_parallel 
./b2 clean 
./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" define=BOOST_SYSTEM_NO_DEPRECATED