我正在尝试使用 mingw 在 Windows 7 x64 机器上构建 boost 库。当我尝试运行 b2 时
b2 --build-dir="C:\boost\build" --toolset=gcc --with-python
构建库时出现错误
Jamroot:138: in modules.load
rule boostcpp.set-version unknown in module Jamfile</C:/Users/root/Downloads/boost_1_47_0>.
C:/Users/root/Downloads/boost_1_47_0/tools/build/v2/build\project.jam:314: in load-jamfile
C:/Users/root/Downloads/boost_1_47_0/tools/build/v2/build\project.jam:62: in load
C:/Users/root/Downloads/boost_1_47_0/tools/build/v2/build\project.jam:168: in project.find
C:/Users/root/Downloads/boost_1_47_0/tools/build/v2\build-system.jam:570: in load
C:\Users\root\Downloads\boost_1_47_0\tools\build\v2/kernel\modules.jam:283: in import
C:\Users\root\Downloads\boost_1_47_0\tools\build\v2\kernel\bootstrap.jam:142: in boost-build
C:\Users\root\Downloads\boost_1_47_0\boost-build.jam:17: in module scope
我做错了什么以及如何解决?任何帮助表示赞赏
Thanks
Edit:
我想将boost库与qt sdk一起使用,qt sdk使用mingw。这就是为什么我无法使用 boost 安装程序。当然,除非我找不到解决这个问题的方法,否则我将不得不求助于使用 msvc 构建的 qt。
这里有一个tutorial http://francky.me/sferes2windows.php#Boost我曾编写过使用 MinGW 在 Windows 7 上编译 Boost 1.45.0 的文章。我将教程复制到此处,以防链接中断:
1)首先我们需要编译Boost。我们将使用 Boost 的最新版本:1.45.0(可能不是您阅读本教程时的最新版本。
1.1) 下载Boost源码:
- http://www.boost.org/users/download/ http://www.boost.org/users/download/
- 或直接:http://sourceforge.net/projects/boost/files/boost/1.45.0/boost_1_45_0.7z/download http://sourceforge.net/projects/boost/files/boost/1.45.0/boost_1_45_0.7z/download)
1.2)为了编译Boost,我们需要使用BJam。 BJam 的源代码包含在 boost 的源代码中。然而,我们无法使用 BJam 的二进制文件:由于以下问题,我们必须编译它:http://comments.gmane.org/gmane.comp.lib.boost.user/64146 http://comments.gmane.org/gmane.comp.lib.boost.user/64146.
要编译 BJam,请转到 Boost 的源代码,找到 build.bat(应位于 \boost_1_45_0\tools\build\v2\engine\src 中),运行 cmd,cd 到 build.bat 的文件夹并执行:build.bat gcc
(source http://www.phy.bnl.gov/~bviren/dayabay/offline/external-trunk/Boost/boost_1_34_1/doc/html/jam/building.html)
编译持续时间不到 30 秒。
-
Note 1:gcc 必须位于 $PATH 中。如果你没有 gcc,你可以在http://www.mingw.org/wiki/InstallationHOWTOforMinGW http://www.mingw.org/wiki/InstallationHOWTOforMinGW。如果您不想浪费时间,请使用自动安装程序。 (安装时不要忘记选择C++编译器,默认只会安装C编译器)
-
Note 2:不要调用 cygwin 的 gcc,否则你会收到“访问被拒绝”错误,请参阅http://omgili.com/mailinglist/cygwin/cygwin/com/m2t961f6df41004191807y75bc02cfiabd7f684a8d5f8camailgmailcom.html http://omgili.com/mailinglist/cygwin/cygwin/com/m2t961f6df41004191807y75bc02cfiabd7f684a8d5f8camailgmailcom.html更多细节。最好使用 MinGW 中包含的 gcc,稍后您将在 IDE 中使用。
1.3)BJam编译完成后,我们现在可以编译Boost了。在$PATH中添加bjam.exe,运行cmd,cd \boost_1_45_0然后执行:
bjam --toolset=gcc "--prefix=C:\DestinationFolder" install
where DestinationFolder
是你想要的任何文件夹路径(source http://wiki.codeblocks.org/index.php?title=BoostWindowsQuickRef).
编译持续约 30 分钟。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)