2013-03-12 57 views
2

在下載升壓1.53.0,乾淨執行的簡化在WinXP升壓安裝MSVC窗戶10.0 - example.cpp無法鏈接

安裝說明

bootstart
\ B2

的建立的庫全部爲 libboost_xxxxx-vc100-mt-gd-1_53.lib ,但由於鏈接器正在查找libboost_xxxxx-vc100-mt-s-gd-1_53.lib,所以我得到鏈接器錯誤。我如何獲得構建的-s(靜態)版本的庫?我假設.lib已經全部是靜態的,但是重命名它們會導致不同的錯誤。

當我編譯example.cpp程序我得到一個鏈接錯誤

$ cl /EHsc -IC:/PROGRA~1/MICROS~1.0/VC/include -ID:/boost/boost_1_53_0 example.cpp /link 
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86 
Copyright (C) Microsoft Corporation. All rights reserved. 

example.cpp 
Microsoft (R) Incremental Linker Version 10.00.30319.01 
Copyright (C) Microsoft Corporation. All rights reserved. 

/out:example.exe 
example.obj 
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-s-1_53.lib' 

如果我複製libboost_regex-VC100-MT-1_53.lib到libboost_regex-VC100-MT-S-1_53.lib(沿與其他IT報告失蹤我得到這樣

msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" ([email protected]@@[email protected]) already defined in libcpmt.lib(xthrow.obj) 

錯誤,當我建立與B2 --build型=完全 d:\提升\ boost_1_53_0> \ B2 --build_type =完全

構建Boost C++庫。

執行配置檢查

- 32-bit     : yes 
- x86      : yes 
- has_icu builds   : no warning: Graph library does not contain MPI-based parallel components. note: to enable them, add 

「使用MPI;」你的用戶config.jam中 - 的iconv(libc中):無 - 的iconv(獨立):無 - ICU:沒有 - ICU(lib64下):無 - GCC的知名度:沒有 - 長雙支撐:是警告:跳過可選的消息傳遞接口(MPI)庫。注意:爲了啓用MPI支持, 添加「使用mpi;」到user-config.jam。注意:要壓制這個消息, 將「--without-mpi」傳遞給bjam。注意:否則,您可以放心地忽略此消息。警告:沒有配置python安裝和 自動配置注意:失敗。見 http://www.boost.org/libs/python/doc/building.html注: 配置說明或通過--without-蟒要注意:抑制 此消息,並自動跳過所有Boost.Python的目標

組件配置:

- atomic     : building 
- chrono     : building 
- context     : building 
- date_time    : building 
- exception    : building 
- filesystem    : building 
- graph     : building 
- graph_parallel   : building 
- iostreams    : building 
- locale     : building 
- math      : building 
- mpi      : building 
- program_options   : building 
- python     : building 
- random     : building 
- regex     : building 
- serialization   : building 
- signals     : building 
- system     : building 
- test      : building 
- thread     : building 
- timer     : building 
- wave      : building 

...耐心。耐心......耐心......耐心......發現 7117對象......

Boost C++庫成功構建!

下面的目錄應該被添加到編譯器包含路徑:

D:/boost/boost_1_53_0 

下面的目錄應該被添加到鏈接庫的路徑:

D:\boost\boost_1_53_0\stage\lib 

我還沒有看到圖書館

> D:\boost\boost_1_53_0>dir D:\boost\boost_1_53_0\stage\lib Volume in 
> drive D is DATA Volume Serial Number is A065-A7DE 
> 
> Directory of D:\boost\boost_1_53_0\stage\lib 
> 
> 03/12/2013 11:26 AM <DIR>   . 03/12/2013 11:26 AM <DIR> 
> .. 03/12/2013 10:36 AM    7,978 
> libboost_atomic-vc100-mt-1_53.lib 03/12/2013 10:26 AM   
> 57,152 libboost_atomic-vc100-mt-gd-1_53.lib 03/12/2013 10:36 AM  
> 355,990 libboost_chrono-vc100-mt-1_53.lib 03/12/2013 10:26 AM   
> 1,493,080 libboost_chrono-vc100-mt-gd-1_53.lib 03/12/2013 10:36 AM 
> 2,710 libboost_context-vc100-mt-1_53.lib 03/12/2013 10:27 AM   
> 5,436 libboost_context-vc100-mt-gd-1_53.lib 03/12/2013 10:36 AM  
> 626,878 libboost_date_time-vc100-mt-1_53.lib 03/12/2013 10:27 AM  
> 2,097,458 libboost_date_time-vc100-mt-gd-1_53.lib 03/12/2013 10:36 AM 
> 5,482 libboost_exception-vc100-mt-1_53.lib 03/12/2013 10:27 AM  
> 39,434 libboost_exception-vc100-mt-gd-1_53.lib 03/12/2013 10:36 AM 
> 871,780 libboost_filesystem-vc100-mt-1_53.lib 03/12/2013 10:27 AM  
> 4,306,464 libboost_filesystem-vc100-mt-gd-1_53.lib 03/12/2013 10:38 
> AM   5,840,912 libboost_graph-vc100-mt-1_53.lib 03/12/2013 
> 10:28 AM  14,463,054 libboost_graph-vc100-mt-gd-1_53.lib 
> 03/12/2013 10:38 AM   418,180 
> libboost_iostreams-vc100-mt-1_53.lib 03/12/2013 10:28 AM   
> 1,272,374 libboost_iostreams-vc100-mt-gd-1_53.lib 03/12/2013 10:39 AM 
> 6,897,100 libboost_locale-vc100-mt-1_53.lib 03/12/2013 10:29 AM  
> 22,057,274 libboost_locale-vc100-mt-gd-1_53.lib 03/12/2013 10:41 AM 
> 809,360 libboost_math_c99-vc100-mt-1_53.lib 03/12/2013 10:31 AM  
> 2,903,758 libboost_math_c99-vc100-mt-gd-1_53.lib 03/12/2013 10:41 AM 
> 810,648 libboost_math_c99f-vc100-mt-1_53.lib 03/12/2013 10:31 AM  
> 2,898,286 libboost_math_c99f-vc100-mt-gd-1_53.lib 03/12/2013 10:41 AM 
> 787,332 libboost_math_c99l-vc100-mt-1_53.lib 03/12/2013 10:31 AM  
> 2,863,258 libboost_math_c99l-vc100-mt-gd-1_53.lib 03/12/2013 10:39 AM 
> 5,859,300 libboost_math_tr1-vc100-mt-1_53.lib 03/12/2013 10:29 AM  
> 14,516,786 libboost_math_tr1-vc100-mt-gd-1_53.lib 03/12/2013 10:40 AM 
> 6,145,246 libboost_math_tr1f-vc100-mt-1_53.lib 03/12/2013 10:30 AM 
> 15,051,100 libboost_math_tr1f-vc100-mt-gd-1_53.lib 03/12/2013 10:40 
> AM   5,807,100 libboost_math_tr1l-vc100-mt-1_53.lib 03/12/2013 
> 10:30 AM  14,407,024 libboost_math_tr1l-vc100-mt-gd-1_53.lib 
> 03/12/2013 10:44 AM   219,580 
> libboost_prg_exec_monitor-vc100-mt-1_53.l ib 03/12/2013 10:34 AM  
> 1,239,714 libboost_prg_exec_monitor-vc100-mt-gd-1_5 
> 3.lib 03/12/2013 10:42 AM   6,461,312 libboost_program_options-vc100-mt-1_53.li b 03/12/2013 10:32 AM  
> 20,176,878 libboost_program_options-vc100-mt-gd-1_53 .lib 03/12/2013 
> 10:42 AM   83,144 libboost_random-vc100-mt-1_53.lib 
> 03/12/2013 10:32 AM   405,594 
> libboost_random-vc100-mt-gd-1_53.lib 03/12/2013 10:37 AM  
> 10,593,312 libboost_regex-vc100-mt-1_53.lib 03/12/2013 10:28 AM  
> 34,707,966 libboost_regex-vc100-mt-gd-1_53.lib 03/12/2013 10:43 AM 
> 11,509,722 libboost_serialization-vc100-mt-1_53.lib 03/12/2013 10:33 
> AM  30,119,740 libboost_serialization-vc100-mt-gd-1_53.l ib 
> 03/12/2013 10:44 AM   1,000,288 
> libboost_signals-vc100-mt-1_53.lib 03/12/2013 10:34 AM   
> 3,919,576 libboost_signals-vc100-mt-gd-1_53.lib 03/12/2013 10:36 AM 
> 83,030 libboost_system-vc100-mt-1_53.lib 03/12/2013 10:26 AM   
> 414,676 libboost_system-vc100-mt-gd-1_53.lib 03/12/2013 10:44 AM  
> 10,382,950 libboost_test_exec_monitor-vc100-mt-1_53. lib 03/12/2013 
> 10:34 AM  24,314,874 libboost_test_exec_monitor-vc100-mt-gd-1_ 
> 53.lib 03/12/2013 10:45 AM   978,672 libboost_thread-vc100-mt-1_53.lib 03/12/2013 10:35 AM   
> 2,921,850 libboost_thread-vc100-mt-gd-1_53.lib 03/12/2013 10:45 AM 
> 177,274 libboost_timer-vc100-mt-1_53.lib 03/12/2013 10:35 AM   
> 858,164 libboost_timer-vc100-mt-gd-1_53.lib 03/12/2013 10:45 AM  
> 11,293,008 libboost_unit_test_framework-vc100-mt-1_5 
> 3.lib 03/12/2013 10:35 AM  26,806,730 libboost_unit_test_framework-vc100-mt-gd- 1_53.lib 03/12/2013 10:46 
> AM  47,173,122 libboost_wave-vc100-mt-1_53.lib 03/12/2013 10:36 
> AM  99,093,052 libboost_wave-vc100-mt-gd-1_53.lib 03/12/2013 
> 10:43 AM   8,910,826 libboost_wserialization-vc100-mt-1_53.lib 
> 
> 03/12/2013 10:33 AM  20,527,762 
> libboost_wserialization-vc100-mt-gd-1_53. lib 03/12/2013 11:26 AM 
> <DIR>   xx 
>    56 File(s) 508,050,750 bytes 
>    3 Dir(s) 8,116,432,896 bytes free 
> 
> D:\boost\boost_1_53_0> 
+3

添加'--build型= complete'你'b2'調用和靜態所有組合/共享,調試/發佈以及單/多線程變體將被構建。 – ildjarn 2013-03-12 18:50:21

+1

請注意.lib文件也是爲DLL生成的(並且在鏈接到這些DLL時使用)。所以.lib文件可能是一個靜態庫,或者它可能只是一個用於鏈接DLL的存根。 – Cameron 2013-03-12 18:55:43

+0

謝謝,將--build-type = complete添加到您的b2調用中有訣竅。並感謝FYI的.lib擴展 – joemooney 2013-03-12 19:30:07

回答

3

你可以s即增強庫的命名約定here。並且可以找到Boost.Build屬性here

所以,如果你需要一個靜態鏈接的CRT靜態庫,調用bjam的是這樣的:

b2 toolset=msvc-10.0 release threading=multi link=static runtime-link=static