win10操作系统下,使用Clion作为C++开发的IDE。最近,开发软件时想添加Boost库,在利用MinGW编译Boost库时遇到几处错误,发现网上相关资料比较少,因此做统一整理。
一、报错一
1、现象
运行指令“b2 install --prefix=“D:\boost_build” --toolset=gcc”,出现报错:Jamroot.jam:107: in modules.load from module Jamfile<D:\boost_1_80_0\tools\build>
warning: Bison generator program ‘bison’ not found. Skipping grammar build.
2、原因
电脑没有安装bison
3、解决方案
参考:http://wjhsh.net/ASE265-p-12532038.html
软件下载链接:http://wjhsh.net/ASE265-p-12532038.html
二、报错二
1、现象
运行boost编译指令,报错“notice: could not find main target stage
notice: assuming it is a name of file to create.
don’t know how to make stage
…found 1 target…
…can’t find 1 target…”
2、原因
编译路径出错。必须在boost的根目录下编译。
3、解决方案
执行指令
cd D:\boost
b2 --build-dir="D:\boost_1_80_0\build" --toolset=gcc --build-type=complete stage
三、报错三
1、现象
在执行Boost编译指令“b2 --build-dir=“D:\boost_1_80_0\build” --toolset=gcc --build-type=complete stage”,报错:“‘b2’ 不是内部或外部命令,也不是可运行的程序或批处理文件。”
2、原因
需要将Boost.Build文件下的\bin添加到环境变量PATH中
3、解决方案
老版本可以将Boost.Build文件下的\bin添加到环境变量PATH中,例如D:\boost_1_76_0_build
新版本先运行一下根目录下的bootstrap.bat文件