8

我正在尝试使用 Visual Studio 2013 构建 Boost 1.55。

1) 我尝试使用 boost-binaries ( boost-binaries ),但是当我尝试编译时,Visual Studio 写了这个错误:

错误 LNK1104:无法打开文件“libboost_serialization-vc120-mt-gd-1_55.lib”。我使用了 boost_1_55_0-msvc-12.0-32.exe 或 1.55.0-build2 (boost-binaries)。

我没有在 boost_1_55_0\lib32-msvc-12.0 目录中找到那个 .lib 文件。

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

问题在于它会创建这样的 .lib 文件:

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

但是我用的是Visual Studio 2013,需要用vc120版本的编译器代替vc110,否则会报错。

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

我在 boost 站点中使用了以下指南: Simplified Build From Source

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

bootstrap
.\b2

上面我写了,我需要做什么。

我启动“VS2012 x86 Native Tools 命令提示符”,将 dir 更改为 boost root 目录并输入命令:

bootstrap

立即我得到了错误:

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.

在日志文件中,我注意到以下错误:

execnt.c(56):致命错误 C1083:无法打开包含文件:'tlhelp32.h':没有这样的文件或目录

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...

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

4)我也尝试重命名

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

libboost_serialization-vc120-mt-gd-1_55.lib

但是 Visual Studio 再次抛出错误。

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

你能告诉我有什么问题以及如何使用 Visual Studio 2013 构建 Boost 1.55 吗?

提前致谢!

4

5 回答 5

4

为包含变量设置的路径指向 Windows 8.0 而不是 Windows 8.1。

您在 Visual Studio 2013 和 Windows 8.1 中提到的文件应在以下路径中找到:

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

我从以下位置修改了 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

至:

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
于 2014-05-08T16:49:09.077 回答
2

让我们一步一步来,首先构建boost构建系统。

“我包含文件('tlhelp32.h')。它编译时没有任何错误。”

因此,该文件存在于磁盘上。由 bootstrap.bat 运行的 cl.exe 的环境变量设置不同。包含文件由 cl.exe 在INCLUDE环境变量中搜索。在磁盘上找到 tlhelp32.h,然后在 Visual Studio 命令提示符中将此路径添加到 INCLUDE:

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

如果找不到某些 .lib,请查看LIBPATH 环境变量。

我想 VS2013 vcvars*.bat 文件没有正确设置环境。

于 2014-02-19T12:53:26.323 回答
0

if you are using windows 8.1, open the vs2012 x86 Tool command prompt,type

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:

edit vcvars32.bat,replace

%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

Microsoft Visual Studio 11.0

to

Microsoft Visual Studio 12.0

open the link,try to build the boost

于 2014-12-27T16:07:20.650 回答
0

构建boost库真的很头疼。所以这就是我发现的并解决了这个问题;

我有同样的错误,我跟着SourceForge。该链接将带您到压缩 lib 和 dll 文件的文件夹以获取 boost 版本。您可以下载并解压缩相关库,然后将其复制到相关位置,一切都会好起来的;)

在项目文件中使用20102012配置会更好。据我所知,2013 年对于 1.55 还不方便。

于 2014-02-20T14:41:01.537 回答
0

似乎 Visual Studio 2013(在我的例子中,它是带有 Update 4 的 Visual Studio 2013 Express)不包括 tlhelp32.h。我刚刚提交了一份关于这个问题的错误报告。为了解决这个问题,除了 Visual Studio 之外,我还安装了 Windows SDK(在我的例子中,它是 Windows 8.1 SDK)。

于 2014-12-08T19:05:34.557 回答