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

时间:2023-01-14 23:16:53

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'. I used boost_1_55_0-msvc-12.0-32.exe or 1.55.0-build2 (boost-binaries).

错误LNK1104:无法打开“libboost_serializ- vc120-mt-gd-1_55.lib”文件。我使用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). It works very smooth, and create all libraries, which I am needed.

2)我也尝试使用BlueGo 0.1.7 (BlueGo)这个程序。它工作非常流畅,并创建所有的库,这是我所需要的。

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.

最后我决定自己创建dll/lib文件。

I used following guide in the boost site: Simplified Build From Source.

我在boost站点中使用了以下指南:从源代码简化构建。

If you wish to build from source with Visual C++, you can use a simple build procedure described in this section. Open the command prompt and change your current directory to the Boost root directory. Then, type the following commands:

如果希望使用Visual c++从源代码构建,可以使用本节中描述的简单构建过程。打开命令提示符并将当前目录更改为Boost根目录。然后输入以下命令:

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本机工具命令提示符”,将dir更改为boost root dir,输入命令:

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:无法打开include文件:'tlhelp32。h':没有这样的文件或目录

The bootstrap.log file:

引导。日志文件:

###
### 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'). I created a project and include the file ('tlhelp32.h'). It is compiled without any errors.

我试图检查这个文件是否存在(“tlhelp32.h”)。我创建了一个项目并包含了这个文件('tlhelp32.h')。它编译时没有任何错误。

4) Also I tried to rename

我还试着重命名

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!

提前谢谢!

5 个解决方案

#1


3  

The paths set up for the include variable point to Windows 8.0 instead of Windows 8.1.

为include变量点而不是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

#2


2  

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. Include files are searched by cl.exe in the INCLUDE env variable. Find tlhelp32.h on the disk and in the Visual Studio Command Prompt add this path to the INCLUDE:

这个文件在磁盘上。环境变量对cl的设置不同。由bootstrap.bat运行的exe。包含文件被cl搜索。在INCLUDE env变量中的exe。找到tlhelp32。在磁盘上和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文件没有正确地设置环境。

#3


0  

Building boost library is really headache. So thats what i found and get ride of it that problem;

构建boost库真是令人头痛。这就是我发现的问题所在;

I had the same error and i followed the 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 ;)

我犯了同样的错误,跟着SourceForge走。该链接将带您到一个压缩库和dll文件的文件夹,用于版本的boost。你可以下载和解压缩相关的库,当它被复制到相关的位置时一切都没问题;)

Using 2010 or 2012 configuration in your project file will be better. As I know 2013 is not convenient for 1.55 yet.

在项目文件中使用2010年或2012年的配置会更好。我知道2013年对于1.55来说还不方便。

#4


0  

It seems that Visual Studio 2013 (in my case, it was Visual Studio 2013 Express with Update 4) doesn't include 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 2013(以我为例,它是Visual Studio 2013 Express)不包含tlhelp32.h。我刚刚提交了一个关于这个问题的错误报告。为了解决这个问题,我在Visual studio之外安装了Windows SDK(在我的例子中,是Windows 8.1 SDK)。

#5


0  

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本地工具命令提示符。链接,复制和粘贴vs2012 x86本机工具命令提示符,右击,修改链接,替换所有。

Microsoft Visual Studio 11.0

to

Microsoft Visual Studio 12.0

open the link,try to build the boost

打开链接,尝试构建boost

#1


3  

The paths set up for the include variable point to Windows 8.0 instead of Windows 8.1.

为include变量点而不是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

#2


2  

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. Include files are searched by cl.exe in the INCLUDE env variable. Find tlhelp32.h on the disk and in the Visual Studio Command Prompt add this path to the INCLUDE:

这个文件在磁盘上。环境变量对cl的设置不同。由bootstrap.bat运行的exe。包含文件被cl搜索。在INCLUDE env变量中的exe。找到tlhelp32。在磁盘上和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文件没有正确地设置环境。

#3


0  

Building boost library is really headache. So thats what i found and get ride of it that problem;

构建boost库真是令人头痛。这就是我发现的问题所在;

I had the same error and i followed the 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 ;)

我犯了同样的错误,跟着SourceForge走。该链接将带您到一个压缩库和dll文件的文件夹,用于版本的boost。你可以下载和解压缩相关的库,当它被复制到相关的位置时一切都没问题;)

Using 2010 or 2012 configuration in your project file will be better. As I know 2013 is not convenient for 1.55 yet.

在项目文件中使用2010年或2012年的配置会更好。我知道2013年对于1.55来说还不方便。

#4


0  

It seems that Visual Studio 2013 (in my case, it was Visual Studio 2013 Express with Update 4) doesn't include 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 2013(以我为例,它是Visual Studio 2013 Express)不包含tlhelp32.h。我刚刚提交了一个关于这个问题的错误报告。为了解决这个问题,我在Visual studio之外安装了Windows SDK(在我的例子中,是Windows 8.1 SDK)。

#5


0  

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本地工具命令提示符。链接,复制和粘贴vs2012 x86本机工具命令提示符,右击,修改链接,替换所有。

Microsoft Visual Studio 11.0

to

Microsoft Visual Studio 12.0

open the link,try to build the boost

打开链接,尝试构建boost