如何使用 VS 在 Windows 7 上安装 Boost

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15766386/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 10:24:00  来源:igfitidea点击:

How to install Boost on Windows 7 with VS

windowsboost

提问by rank1

So I am trying for whole day to integrate Boost with Visual Studio (2008) on Windows 7. I firstly I went twice trough this How to use Boost in Visual Studio 2010.

所以我一整天都在尝试在 Windows 7 上将 Boost 与 Visual Studio (2008) 集成。我首先通过这个How to use Boost in Visual Studio 2010进行了两次。

I searched over all (there are at least 3 of them) simiral topics and none of them worked.

我搜索了所有(至少有 3 个)类似的主题,但没有一个起作用。

Some people proposed using this one : www.boostpro.com/download/but link is not active. Someone proposed to change runtime library to Multi-threaded DLL but is also didnt work.

有人建议使用这个:www.boostpro.com/download/但链接无效。有人提议将运行时库更改为多线程 DLL,但也没有奏效。

I just try to include #include <boost/thread.hpp>and got this error

我只是尝试包含#include <boost/thread.hpp>并收到此错误

fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-s-1_53.lib'.

致命错误 LNK1104:无法打开文件“libboost_thread-vc90-mt-s-1_53.lib”。

Before installing Boost the error was that it cannot find the thread.hppso it seems like the Boost is installed somewhat correctly.

在安装 Boost 之前,错误是它找不到thread.hppBoost ,所以看起来 Boost 安装得有点正确。

The problem is that the libraries were not build while I was using the tutorial. How can I build them manually?

问题是我在使用教程时没有构建库。如何手动构建它们?

采纳答案by rank1

Use this command: bjam --build-dir=build-directory toolset=toolset-name --build-type=complete stage this build the libraries manually. Then add the new directory to additional libraries path

使用以下命令: bjam --build-dir=build-directory toolset=toolset-name --build-type=complete 手动构建库。然后将新目录添加到其他库路径

as it is indicated in this link: http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#or-build-binaries-from-source

正如此链接中所示:http: //www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#or-build-binaries-from-source

回答by Andriy Tylychko

There's no such thing like one-click boost install, you still need to do something manually. In your case it seems you need to compile Boost.Thread library and then add directory where resulting .lib file is to your library path. The link you provided looks pretty good. If you followed it probably you already built Boost.Thread. Make sure you did #6 from the second part.

没有像一键式提升安装这样的东西,您仍然需要手动执行某些操作。在您的情况下,您似乎需要编译 Boost.Thread 库,然后将生成的 .lib 文件所在的目录添加到您的库路径中。您提供的链接看起来不错。如果您遵循它,您可能已经构建了 Boost.Thread。确保你做了第二部分的#6。

回答by Aleksey Kontsevich

There are prebuild binaries - installation packages: http://sourceforge.net/projects/boost/files/boost-binaries/1.53.0/

有预编译二进制文件 - 安装包:http: //sourceforge.net/projects/boost/files/boost-binaries/1.53.0/

回答by anhoppe

I found this article quite helpful:

我发现这篇文章很有帮助:

http://www.codeproject.com/Articles/11597/Building-Boost-libraries-for-Visual-Studio

http://www.codeproject.com/Articles/11597/Building-Boost-libraries-for-Visual-Studio

  • The article explains how to build the build tool BJam (mainly by locating the boostrapper.bat)
  • How to build the libraries, e.g. bjam toolset=msvc-11.0 variant=debug threading=multi link=static(in this case the VS2012 multi-threaded, statically linked debug version).
  • It also features build batches, but I haven't tried them.
  • It has some additional information on how to specifiy the used C-Runtime
  • 文章讲解如何搭建构建工具BJam(主要通过定位boostrapper.bat)
  • 如何构建库,例如bjam toolset=msvc-11.0 variant=debug threading=multi link=static(在本例中为 VS2012 多线程、静态链接调试版本)。
  • 它还具有构建批次功能,但我还没有尝试过。
  • 它有一些关于如何指定使用的 C-Runtime 的附加信息