Win10系统中使用VS2017编译Boost1.65的方法

在Win10系统中使用VS2017编译Boost1.65,若直接打开命令行窗口,执行“bootstrap.bat”,会出现如下错误提示:


Building Boost.Build engine


Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.


You can try to obtain a prebuilt binary from


   http://sf.net/project/showfiles.php?group_id=7586&package_id=72941


Also, you can file an issue at http://svn.boost.org
Please attach bootstrap.log in that case.


对应的“bootstrap.log”文件中提示的具体错误信息如下:


**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26730.16
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
###
### Using 'vc141' toolset.
###


C:\Users\xtc-dhj\source>if exist bootstrap rd /S /Q bootstrap 


C:\Users\xtc-dhj\source>md bootstrap 


C:\Users\xtc-dhj\source>cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib /Febootstrap\yyacc0 yyacc.c 
yyacc.c
c1: fatal error C1083: 无法打开源文件: “yyacc.c”: No such file or directory




解决方法,可以逐一对照检查以下几项:


1.检查环境变量“Path”是否添加了“C:\Windows\System32”;


2.在“开始”菜单栏找到VS安装项(本机为Visual Studio 2017),打开该项下的“x64 Native Tools Command Prompt for VS 2017”命令行(可根据需要选择对应的命令行,我需要编译64位版本,因此选择64位命令行)(Win10下,该命令行对应的文件路径为:C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\VC)


3.在命令行窗口中,将当前路径切换为Boost解压后所在的文件夹,本机命令为:


C:\Users\xtc-dhj\source>cd D:\软件备份\boost\boost_1_65_1
C:\Users\xtc-dhj\source>d:


4.运行命令:bootstrap.bat,对应的信息如下:



D:\软件备份\boost\boost_1_65_1>bootstrap.bat


Building Boost.Build engine


Bootstrapping is done. To build, run:


    .\b2


To adjust configuration, edit 'project-config.jam'.
Further information:


    - Command line help:
    .\b2 --help


    - Getting started guide:
    http://boost.org/more/getting_started/windows.html


    - Boost.Build documentation:
    http://www.boost.org/build/doc/html/index.html


D:\软件备份\boost\boost_1_65_1>




5.如果执行第4步出错,请显式地指定VC版本(版本号为:VS2017-->vc141, VS2015-->vc140, VS2013->vc120,VS2012-->vc110, VS2010-->vc100),如下所示:


D:\软件备份\boost\boost_1_65_1>bootstrap.bat vc141


6.运行命令: .\b2,完成编译:


D:\软件备份\boost\boost_1_65_1>.\b2



  • 8
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值