首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >boost install windows msvc 10.0 -- example.cpp链接失败

boost install windows msvc 10.0 -- example.cpp链接失败
EN

Stack Overflow用户
提问于 2013-03-12 18:47:47
回答 1查看 2.3K关注 0票数 2

下载boost 1.53.0并在WinXP上干净地执行简化的安装说明

启动\B2

构建的库都是libboost_xxxxx- of 100-mt-gd-1_53.lib,但是我得到链接器错误,因为链接器正在查找libboost_xxxxx-of 100-mt-s-gd-1_53.lib。如何构建库的-s (静态)版本?我假设.lib已经是静态的,但是重命名它们会导致不同的错误。

当我编译example.cpp程序时,我会得到一个链接器错误

代码语言:javascript
复制
$ 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- it 100-mt-1_53 like复制到libboost_regex-vc100-mt 1_53 like(与其他报告一样,我会得到如下错误:

代码语言:javascript
复制
msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) already defined in libcpmt.lib(xthrow.obj)

当我用b2构建时--构建类型=完全D:\boost\boost_1_53_0>.\b2 - build _type=complete

构建Boost C++库。 执行配置检查

  • 32位:是- x86 : yes - has_icu构建:无警告:图库不包含基于MPI的并行组件.注意:要启用它们,请添加 “使用mpi ;”给您的用户-config.jam- iconv (libc):no - iconv (分离):no - icu : no - icu (lib64):no - gcc可见性: no -gcc可见性:no- long双支持:是警告:跳过可选的消息传递接口库。注意:要启用MPI支持,请将“使用mpi ;”添加到user-config.jam。注:若要取消此消息,请将“--无-mpi”传递给bjam。注意:否则,您可以安全地忽略此消息。警告:未配置python安装,自动配置说明:失败。请参阅http://www.boost.org/libs/python/doc/building.html注释:有关配置说明或传递--无需python注意:抑制此消息并悄悄跳过所有Boost.Python目标。 组件配置:
  • 原子:建筑物-时间顺序:建筑物-上下文: date_time : building : building : building :build-graph_parallel: building : building建筑-数学:建筑- mpi :建筑- program_options :建筑- python :建筑-随机:建筑-正则:建筑-序列化:建筑-信号:建筑-系统:建筑物.试验:建筑物.螺纹:建筑物.定时器:建筑物.波浪:建筑物 ...patience......patience......patience......patience......found 7117目标. Boost C++库已经成功构建! 应将下列目录添加到编译器包含路径: D:/boost/boost_1_53_0 应将下列目录添加到链接器库路径: D:\boost\boost_1_53_0\stage\lib

我还是没看到图书馆

代码语言:javascript
复制
> 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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-12 19:30:20

您可以看到boost库这里的命名约定。Boost.Build属性可以找到这里

因此,如果需要静态链接CRT的静态库,请按以下方式调用bjam:

代码语言:javascript
复制
b2 toolset=msvc-10.0 release threading=multi link=static runtime-link=static
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15369613

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档