我一直尝试在 Windows 中使用 b2 编译 Boost 库,但使用 Clang/C2(带有 Microsoft CodeGen 的 Clang 3.7),但没有成功。由于 Visual Studio 附带了多个在构建时使用的工具集,因此似乎指定哪个工具集应该不会太难。我看过另一篇关于“在 Windows 上使用 clang 3.8 构建 boost”的帖子,但他建议用作 b2 的命令行是错误的,因为它并没有真正从 MSVC 调用 clang 编译器。使用以下命令行发帖的人:
b2 --build-dir=build toolset=clang --build-type=complete stage
我对 b2 和 Boost.Build 工具很陌生...我只想使用来自 MSVC 的 Boost 和 Clang/C2 而不是默认编译器。
任何反馈将不胜感激..
胡安·登特
顺便说一句:我正在使用 Visual Studio 2015 Update 3。
boost
支持 clang
上的 mac os x
,因此它应该构建在 windows
和 linux
上。
On
windows
boost
默认情况下为 visual studio
构建。当构建 mingw
时,我在 bootstrap.bat mingw
之前运行 b2
。因此,要在 clang
上构建 windows
,请确保 clang
位于 PATH
中并尝试:
cd boost_1_xx_0
bootstrap.bat clang
b2 -j8 toolset=clang address-model=64 architecture=x86 --build-dir=build --build-type=complete stage
要使用 Visual Studio 的 clang (clang-cl) 进行构建,请使用
toolset=clang-win
。我在搜索相同信息时遇到了这个问题,并从这个相关问题中收集了答案。使用 Visual Studio 2022 进行测试。