且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 MSVC 14.0 (VS 2015) 编译 Boost 时编译器版本未知

更新时间:2023-09-15 23:24:46

最新(发布此答案时)Boost 1.58 确实支持 MSVC 14.0 PreviewBoost 1.58 发布时最新的 MS 编译器.现在,最新版本的 Visual Studio2015 RC,boost 1.58 配置文件中未包含该版本.

Latest (at the time of posting this answer) Boost 1.58 does support MSVC 14.0 Preview which was the latest MS compiler at the time of Boost 1.58 release. Now, the latest version of Visual Studio is 2015 RC which isn't covered in the boost 1.58 config file.

要停止 Boost 1.58 抱怨未知编译器版本,请编辑 boost/config/compiler/visualc.hpp 并替换:

To stop Boost 1.58 complaining about unknown compiler version edit boost/config/compiler/visualc.hpp and replace:

// last known and checked version is 19.00.22129 (VC14 Preview):
#if (_MSC_VER > 1800 && _MSC_FULL_VER > 190022310)

与:

// last known and checked version is 19.00.22816 (VC++ 2015 RC):
#if (_MSC_VER > 1800 && _MSC_FULL_VER > 190022816)

您可以在boost repo 此处中找到即将推出的Boost1.59 发布.

which you can find is already done in boost repo here for upcoming Boost 1.59 release.

更新:对于 Visual Studio 2015 RTM,将其设置为:

// last known and checked version is 19.00.23026 (VC++ 2015):
#if (_MSC_VER > 1800 && _MSC_FULL_VER > 190023026)

Update2:对于 Visual Studio 2015 Update 1,将其设置为:

// last known and checked version is 19.00.23506 (VC++ 2015 Update 1):
#if (_MSC_VER > 1800 && _MSC_FULL_VER > 190023506)

此外,如果您之前一直在 toolset=msvc-14.0 上运行 Boost.Build,则从 C:UsersAppDataLocalTemp 中删除> 以下缓存文件:


Also if you have previously been running Boost.Build on toolset=msvc-14.0 then delete from C:Users<name>AppDataLocalTemp the following cached files:

b2_msvc_14.0_vcvarsall_x86.cmd 
b2_msvc_14.0_vcvarsall_x86_amd64.cmd 
b2_msvc_14.0_vcvarsall_x86_arm.cmd

此处了解更多相关信息.

Update3为了将来参考,在您的 Visual Studio 工具命令提示符中运行命令 cl/Bv 以查看您的版本号(参数区分大小写).

Update3 For future reference, in your Visual Studio Tools Command Prompt run the command cl /Bv to see your version numbers (the parameters are case sensitive).

我的输出如下:

C:Program Files (x86)Microsoft Visual StudioPreviewProfessionalVCToolsMSVC14.11.25503inHostX64x64cl.exe:        Version 19.11.25506.0
 C:Program Files (x86)Microsoft Visual StudioPreviewProfessionalVCToolsMSVC14.11.25503inHostX64x64c1.dll:        Version 19.11.25506.0
 C:Program Files (x86)Microsoft Visual StudioPreviewProfessionalVCToolsMSVC14.11.25503inHostX64x64c1xx.dll:      Version 19.11.25506.0
 C:Program Files (x86)Microsoft Visual StudioPreviewProfessionalVCToolsMSVC14.11.25503inHostX64x64c2.dll:        Version 19.11.25506.0
 C:Program Files (x86)Microsoft Visual StudioPreviewProfessionalVCToolsMSVC14.11.25503inHostX64x64link.exe:      Version 14.11.25506.0
 C:Program Files (x86)Microsoft Visual StudioPreviewProfessionalVCToolsMSVC14.11.25503inHostX64x64mspdb140.dll:  Version 14.11.25506.0
 C:Program Files (x86)Microsoft Visual StudioPreviewProfessionalVCToolsMSVC14.11.25503inHostX64x641033clui.dll: Version 19.11.25506.0

由此您可以推断出_MSC_VER 是1911(来自文本Version 19.11")而_MSC_FULL_VER 是191125506.

From this you can deduce the _MSC_VER is 1911 (from the text "Version 19.11") and the _MSC_FULL_VER is 191125506.