我想编译一个需要使用静态链接构建boost库的程序,因为在Visual Studio 2017社区中,我收到以下链接器错误:
LINK : fatal error LNK1104: File "libboost_filesystem-vc140-mt-gd-1_63.lib" could not be opened.
我早在很早以前就用不同的VS版本对其进行了编译。
因此,我尝试按照page中的描述编译boost 1.63。在VS命令提示符中,我采用了this answer中的参数(但是仅带参数的b2也不起作用)
bootstrap
b2 -j8 toolset=msvc-14.1 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=complete stage
调用b2之后,我在命令窗口中收到以下错误消息:
C:/Program Files/boost_1_63_0/tools/build/src/tools\msvc.jam:834: in generate-se
tup-cmd
*** argument error
* rule maybe-rewrite-setup ( toolset : setup-script : setup-options : version :
rewrite-setup ? )
* called with: ( msvc : : : default : )
* missing argument setup-script
C:/Program Files/boost_1_63_0/tools/build/src/tools\msvc.jam:746:see definition
of rule 'maybe-rewrite-setup' being called
C:/Program Files/boost_1_63_0/tools/build/src/tools\msvc.jam:1076: in configure-
really
C:/Program Files/boost_1_63_0/tools/build/src/tools\msvc.jam:201: in configure
C:/Program Files/boost_1_63_0/tools/build/src/tools\msvc.jam:153: in msvc.init
C:/Program Files/boost_1_63_0/tools/build/src/build\toolset.jam:43: in toolset.u
sing
C:/Program Files/boost_1_63_0/tools/build/src/build\project.jam:1052: in using
project-config.jam:3: in modules.load
C:/Program Files/boost_1_63_0/tools/build/src\build-system.jam:249: in load-conf
ig
C:/Program Files/boost_1_63_0/tools/build/src\build-system.jam:412: in load-conf
iguration-files
C:/Program Files/boost_1_63_0/tools/build/src\build-system.jam:524: in load
C:\Program Files\boost_1_63_0\tools\build\src/kernel\modules.jam:295: in import
C:\Program Files\boost_1_63_0\tools\build\src/kernel/bootstrap.jam:139: in boost
-build
C:\Program Files\boost_1_63_0\boost-build.jam:17: in module scope
问题:这是什么问题?如何构建所需的库?