如何使用clang ++ / libc ++编译/链接Boost?

时间:2011-12-13 08:14:53

标签: c++ boost clang libc++

这个问题Why can't clang with libc++ in c++0x mode link this boost::program_options example?的答案指出“你需要使用clang ++ -stdlib = libc ++重建boost。”

我正在使用带有clang v3.0的MacOS Lion。如何使用clang构建Boost v1.48.0并将其与libc ++链接?

更新:我创建了一个 user-config.jam 文件,其中包含以下内容:

using clang-darwin

...将使用clang而不是gcc构建Boost。如何链接libc ++而不是libstdc ++?

2 个答案:

答案 0 :(得分:92)

我也不知道怎么做。但在heregetting startedtrial以及错误:

之后。
$ ./bootstrap --with-toolset=clang
$ ./b2 clean
$ ./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++"

你会收到很多警告。由于LWG 2059,信号库将无法构建。但除此之外我认为它有效。

答案 1 :(得分:15)

另一种选择是使用Homebrew

brew install boost --c++11

要获取有关所有选项的信息,请使用:

brew info boost
相关问题