How to build Boost 1.55 with Visual Studio 2013?

岁酱吖の 提交于 2019-12-09 10:43:59

问题


I'm trying to build Boost 1.55 with Visual Studio 2013.

1) I tried to use boost-binaries (boost-binaries), but Visual Studio wrote about the error, when I tried to compile:

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

I didn't find that .lib file in the boost_1_55_0\lib32-msvc-12.0 directory.

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.

The problem in that it creates .lib files like this:

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.

3) In the end I decided to create dll/lib files on my own.

I used following guide in the boost site: 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. Open the command prompt and change your current directory to the Boost root directory. 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:

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

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.

4) Also I tried to rename

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

to

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

But Visual Studio thrown the error again.

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?

Thanks in advance!


回答1:


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

The file you mention with Visual Studio 2013 and Windows 8.1 should be found in the following path:

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

I modified the INCLUDE variable from:

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:


Let's go step by step and first build boost build system.

"I include the file ('tlhelp32.h'). It is compiled without any errors."

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:

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

If some .lib will not be found look at LIBPATH env variable.

I suppose VS2013 vcvars*.bat files did not set the environment properly.




回答3:


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

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 ;)

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




回答4:


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




回答5:


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



来源:https://stackoverflow.com/questions/21878267/how-to-build-boost-1-55-with-visual-studio-2013

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!