簡體   English   中英

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

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

我正在嘗試使用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?

提前致謝!

為include變量設置的路徑指向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

讓我們一步一步,首先構建boost構建系統。

“我包含了文件('tlhelp32.h')。它編譯時沒有任何錯誤。”

因此,該文件存在於磁盤上。 對於由bootstrap.bat運行的cl.exe,環境變量的設置方式不同。 IncL文件由INCLUDE env變量中的cl.exe搜索。 在磁盤上找到tlhelp32.h,在Visual Studio命令提示符中將此路徑添加到INCLUDE:

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

如果找不到某個.lib,請查看LIBPATH env變量。

我想VS2013 vcvars * .bat文件沒有正確設置環境。

構建boost庫真的很頭疼。 這就是我發現的東西,並把它解決了這個問題;

我有同樣的錯誤,我跟着SourceForge 該鏈接將帶您到壓縮文件夾和壓縮文件的DLL文件夾。您可以下載並解壓縮相關的庫,並將其復制到相關位置一切都會好的;)

在項目文件中使用20102012配置會更好。 據我所知2013年還不方便1.55。

似乎Visual Studio 2013(在我的例子中,它是Visual Studio 2013 Express with Update 4)不包括tlhelp32.h。 我剛剛提交了一個關於這個問題的錯誤報告 為了解決這個問題,除了Visual Studio之外我安裝了Windows SDK(在我的例子中,它是Windows 8.1 SDK)。

如果您使用的是Windows 8.1,請打開vs2012 x86工具命令提示符,鍵入

echo %WindowsSdkDir%

如果你在下面看到這個

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

這意味着vcvars32.bat為您設置了錯誤的INCLUDE變量,該問題在ms網站中標記為bug,因此解決方案是:

編輯vcvars32.bat,替換

%WindowsSDKDir%\include\um;

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

另一個解決方案是修改VS2012 x86 Native Tools命令Prompt.link,復制並粘貼vs2012 x86 Native Tools命令提示符,右鍵單擊,修改鏈接,全部替換

Microsoft Visual Studio 11.0

Microsoft Visual Studio 12.0

打開鏈接,嘗試構建提升

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM