简体   繁体   English

如何使用Visual Studio 2013构建Boost 1.55?

[英]How to build Boost 1.55 with Visual Studio 2013?

I'm trying to build Boost 1.55 with Visual Studio 2013. 我正在尝试使用Visual Studio 2013构建Boost 1.55。

1) I tried to use boost-binaries ( boost-binaries ), but Visual Studio wrote about the error, when I tried to compile: 1)我尝试使用boost-binaries( boost-binaries ),但是当我尝试编译时,Visual Studio写了关于错误的信息:

error LNK1104: cannot open file 'libboost_serialization-vc120-mt-gd-1_55.lib'. 错误LNK1104:无法打开文件'libboost_serialization-vc120-mt-gd-1_55.lib'。 I used boost_1_55_0-msvc-12.0-32.exe or 1.55.0-build2 (boost-binaries). 我使用了boost_1_55_0-msvc-12.0-32.exe或1.55.0-build2(boost-binaries)。

I didn't find that .lib file in the boost_1_55_0\\lib32-msvc-12.0 directory. 我没有在boost_1_55_0 \\ lib32-msvc-12.0目录中找到.lib文件。

2) I also tried to use this program BlueGo 0.1.7 ( BlueGo ). 2)我也尝试使用这个程序BlueGo 0.1.7( BlueGo )。 It works very smooth, and create all libraries, which I am needed. 它工作非常顺利,并创建我需要的所有库。

The problem in that it creates .lib files like this: 问题在于它创建了像这样的.lib文件:

libboost_serialization-vc110-mt-gd-1_55.lib libboost_serialization-vc110-MT-GD-1_55.lib

But I use Visual Studio 2013 and it is required to use vc120 version of compiler instead vc110, overwise it is thrown an error. 但我使用Visual Studio 2013并且需要使用vc120版本的编译器而不是vc110,过度使用它会引发错误。

3) In the end I decided to create dll/lib files on my own. 3)最后我决定自己创建dll / lib文件。

I used following guide in the boost site: Simplified Build From Source . 我在boost站点中使用了以下指南: Simplified Build From Source

If you wish to build from source with Visual C++, you can use a simple build procedure described in this section. 如果您希望使用Visual C ++从源代码构建,可以使用本节中描述的简单构建过程。 Open the command prompt and change your current directory to the Boost root directory. 打开命令提示符并将当前目录更改为Boost根目录。 Then, type the following commands: 然后,键入以下命令:

bootstrap
.\b2

Above I wrote, what I needed to do. 上面我写了,我需要做什么。

I launched "VS2012 x86 Native Tools Command Prompt", changed dir to the boost root dir and entered the command: 我启动了“VS2012 x86 Native Tools命令提示符”,将dir更改为boost root目录并输入命令:

bootstrap

Immediately I got the error: 我马上得到了错误:

C:\thirdparty\vs2013\x86\boost_1_55_0>.\bootstrap.bat
Building Boost.Build engine

Failed to build Boost.Build engine.
Please consult bootstrap.log for furter diagnostics.

You can try to obtain a prebuilt binary from

   http://sf.net/project/showfiles.php?group_id=7586&package_id=72941

Also, you can file an issue at http://svn.boost.org
Please attach bootstrap.log in that case.

In the log file I noticed following error: 在日志文件中,我注意到以下错误:

execnt.c(56) : fatal error C1083: Cannot open include file: 'tlhelp32.h': No such file or directory execnt.c(56):致命错误C1083:无法打开包含文件:'tlhelp32.h':没有这样的文件或目录

The bootstrap.log file: bootstrap.log文件:

###
### Using 'vc12' toolset.
###

C:\thirdparty\vs2013\x86\boost_1_55_0\tools\build\v2\engine>if exist bootstrap rd /S /Q bootstrap 

C:\thirdparty\vs2013\x86\boost_1_55_0\tools\build\v2\engine>md bootstrap 

C:\thirdparty\vs2013\x86\boost_1_55_0\tools\build\v2\engine>cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib /Febootstrap\jam0  command.c compile.c constants.c debug.c execcmd.c execnt.c filent.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathnt.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c md5.c class.c cwd.c w32_getreg.c native.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c 
command.c
compile.c
constants.c
debug.c
execcmd.c
execnt.c
execnt.c(56) : fatal error C1083: Cannot open include file: 'tlhelp32.h': No such file or directory
filent.c
frames.c
function.c
glob.c
hash.c
hdrmacro.c
headers.c
jam.c
jambase.c
jamgram.c
lists.c
make.c
make1.c
object.c
Generating Code...
Compiling...
option.c
output.c
parse.c
pathnt.c
pathsys.c
regexp.c
rules.c
scan.c
search.c
subst.c
timestamp.c
variable.c
modules.c
strings.c
filesys.c
builtins.c
md5.c
class.c
cwd.c
w32_getreg.c
Generating Code...
Compiling...
native.c
set.c
path.c
regex.c
property-set.c
sequence.c
order.c
Generating Code...

I tried to check existed this file or not ('tlhelp32.h'). 我试着检查是否存在这个文件('tlhelp32.h')。 I created a project and include the file ('tlhelp32.h'). 我创建了一个项目并包含文件('tlhelp32.h')。 It is compiled without any errors. 编译没有任何错误。

4) Also I tried to rename 4)我也尝试重命名

libboost_serialization-vc110-mt-gd-1_55.lib libboost_serialization-vc110-MT-GD-1_55.lib

to

libboost_serialization-vc120-mt-gd-1_55.lib libboost_serialization-VC120-MT-GD-1_55.lib

But Visual Studio thrown the error again. 但Visual Studio再次抛出错误。

Error   1   error LNK1104: cannot open file 'libboost_serialization-vc120-mt-gd-1_55.lib'.

Could you tell me what is the problem and how to build Boost 1.55 with Visual Studio 2013? 你能告诉我是什么问题以及如何使用Visual Studio 2013构建Boost 1.55?

Thanks in advance! 提前致谢!

The paths set up for the include variable point to Windows 8.0 instead of Windows 8.1. 为include变量设置的路径指向Windows 8.0而不是Windows 8.1。

The file you mention with Visual Studio 2013 and Windows 8.1 should be found in the following path: 您在Visual Studio 2013和Windows 8.1中提到的文件应在以下路径中找到:

C:\Program Files (x86)\Windows Kits\8.1\include\um

I modified the INCLUDE variable from: 我修改了INCLUDE变量:

INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program Files (x86)\Windows Kits\8.0\include\um;C:\Program Files (x86)\Windows Kits\8.0\include\winrt

to: 至:

INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program Files (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt

Let's go step by step and first build boost build system. 让我们一步一步,首先构建boost构建系统。

"I include the file ('tlhelp32.h'). It is compiled without any errors." “我包含了文件('tlhelp32.h')。它编译时没有任何错误。”

So, that file is present on the disk. 因此,该文件存在于磁盘上。 Environment variables are set differently for cl.exe which is run by bootstrap.bat. 对于由bootstrap.bat运行的cl.exe,环境变量的设置方式不同。 Include files are searched by cl.exe in the INCLUDE env variable. IncL文件由INCLUDE env变量中的cl.exe搜索。 Find tlhelp32.h on the disk and in the Visual Studio Command Prompt add this path to the INCLUDE: 在磁盘上找到tlhelp32.h,在Visual Studio命令提示符中将此路径添加到INCLUDE:

set INCLUDE=%INCLUDE%;<path to tlhelp32.h>

If some .lib will not be found look at LIBPATH env variable. 如果找不到某个.lib,请查看LIBPATH env变量。

I suppose VS2013 vcvars*.bat files did not set the environment properly. 我想VS2013 vcvars * .bat文件没有正确设置环境。

Building boost library is really headache. 构建boost库真的很头疼。 So thats what i found and get ride of it that problem; 这就是我发现的东西,并把它解决了这个问题;

I had the same error and i followed the SourceForge . 我有同样的错误,我跟着SourceForge The link will take you to a folder of zipped lib and dll files for version of boost.You can download and unzip related library and when copied it to the related location everything gonna be alright ;) 该链接将带您到压缩文件夹和压缩文件的DLL文件夹。您可以下载并解压缩相关的库,并将其复制到相关位置一切都会好的;)

Using 2010 or 2012 configuration in your project file will be better. 在项目文件中使用20102012配置会更好。 As I know 2013 is not convenient for 1.55 yet. 据我所知2013年还不方便1.55。

It seems that Visual Studio 2013 (in my case, it was Visual Studio 2013 Express with Update 4) doesn't include tlhelp32.h. 似乎Visual Studio 2013(在我的例子中,它是Visual Studio 2013 Express with Update 4)不包括tlhelp32.h。 I've just submitted a bug report about this problem. 我刚刚提交了一个关于这个问题的错误报告 To resolve this problem, I installed the Windows SDK in addition to Visual studio (in my case, it was Windows 8.1 SDK). 为了解决这个问题,除了Visual Studio之外我安装了Windows SDK(在我的例子中,它是Windows 8.1 SDK)。

if you are using windows 8.1, open the vs2012 x86 Tool command prompt,type 如果您使用的是Windows 8.1,请打开vs2012 x86工具命令提示符,键入

echo %WindowsSdkDir%

if you see this below 如果你在下面看到这个

C:\Program Files (x86)\Windows Kits\8.0\

that means vcvars32.bat set the wrong INCLUDE variable for you,which issue marked as bug in ms website so the solution is: 这意味着vcvars32.bat为您设置了错误的INCLUDE变量,该问题在ms网站中标记为bug,因此解决方案是:

edit vcvars32.bat,replace 编辑vcvars32.bat,替换

%WindowsSDKDir%\include\um;

to

C:\Program Files (x86)\Windows Kits\8.1\include\um;

another solutions is modify the VS2012 x86 Native Tools Command Prompt.link,copy and paste the vs2012 x86 Native Tools Command Prompt ,right click,modify the link,replace all 另一个解决方案是修改VS2012 x86 Native Tools命令Prompt.link,复制并粘贴vs2012 x86 Native Tools命令提示符,右键单击,修改链接,全部替换

Microsoft Visual Studio 11.0

to

Microsoft Visual Studio 12.0

open the link,try to build the boost 打开链接,尝试构建提升

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM