C++ 使用MSVC 11进行Boost编译(VS 2012)
如何使用构建Boost(我尝试过的版本)<代码>引导.bat找不到工具集C++ 使用MSVC 11进行Boost编译(VS 2012),c++,visual-c++,boost,visual-studio-2012,boost-build,C++,Visual C++,Boost,Visual Studio 2012,Boost Build,如何使用构建Boost(我尝试过的版本)引导.bat找不到工具集vc11。我将工具集vc11添加到F:\Programming\boost\u 1\u 48\u 0\tools\build\v2\engine\build.bat,但收到一条消息: ERROR: Cannot determine the location of the VS Common Tools folder. 编辑:Ferruccio也适用于VS 2012 Express和Boost 1.51.0。我通过以下步骤成功构建了
vc11
。我将工具集vc11添加到F:\Programming\boost\u 1\u 48\u 0\tools\build\v2\engine\build.bat
,但收到一条消息:
ERROR: Cannot determine the location of the VS Common Tools folder.
编辑:Ferruccio也适用于VS 2012 Express和Boost 1.51.0。我通过以下步骤成功构建了它:
<强> Update:我创建了GITHUB RePO,这使得构建Boost和其他C++库更为简单。
< P>检查以下命令的输出:检查您的安装是否正确:C:\>echo %VS110COMNTOOLS%
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
以下是一些在引导时消除警告的简单说明:
不要错过他关于自动链接的后续文章。这个答案适用于:
(Visual Studio 2012更新2)VS2012
- 或
(Visual Studio 2015更新2)VS2015
- 或
- Windows 7 x64
- 或Windows 10 x64
- Boost v1.53
- 或Boost v1.60
所有程序..Microsoft Visual Studio 2012..Visual Studio工具..x64本机工具命令提示符
boost\u 1\u 53\u 0.zip解压缩到C:\boost153
bootstrap.bat
bjam.exe
所有程序..Microsoft Visual Studio 2012..Visual Studio Tools..x64本机工具命令提示符
cd c:\boost153
切换到boost目录bootstrap.bat
bjam.exe
。这将构建所有库The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
C:/boost153
The following directory should be added to linker library paths:
C:\boost153\stage\lib
C:/boost153
添加到编译器包含路径中,并将C:\boost153\stage\lib
添加到链接器库路径中李>
右键单击项目,选择属性
,选择配置属性..VC++目录
。请参见以下屏幕截图中粗体文本的两部分):
让我们运行一个简单的程序,通过添加对foreach
循环的支持来展示boost的威力:
// Source code below copied from:
// http://www.boost.org/doc/libs/1_53_0/doc/html/foreach.html
#include "stdafx.h"
#include <string>
#include <iostream>
#include <conio.h> // Supports _getch()
#include <boost/foreach.hpp>
int main()
{
std::string hello( "Hello, world!" );
BOOST_FOREACH( char ch, hello )
{
std::cout << ch;
}
_getch();
return 0;
}
更多答案
- 看李>
- 看
- 看
更新2016-05-05
使用Win10 x64检查错误:无法确定VS公用工具文件夹的位置
vcvarsall.bat需要调用“C:\windows\system32\”中的“reg.exe”。
如果不在搜索路径中,将导致此错误
将C:\windows\system32添加到%PATH%将解决此问题。bootstrap.bat
bjam.exe--toolset=msvc-11除了上面的答案,我发现使用msvc 10/11/12构建boost版本非常有用。您可以选择不同的配置,只需选择build,就可以了 多亏了这一点,如果您通过(HKCU | | HKLM)\Software\Microsoft\Command Processor:reg_sz AutoRun
执行doskey.exe
,比boost doc的implyware要容易得多。生成导致doskey
崩溃,生成失败。我已提交。此构建并非所有库要构建其他所需库,请向bjam
或b2
命令添加选项。一些常见的交换机正在为静态/共享、x32/x64等或自boost 1.47.0以来构建库--toolset=msvc-11
。这个答案似乎比从devshell重新运行引导程序并忽略上传警告要正确得多。
Hello, world!