如何选择编译boost后生成的库文件

edwardlj 2007-01-30 09:35:59
编译boost的date_time库后生成了一堆库文件,如:
libboost_date_time-gcc-1_33_1.so
libboost_date_time-gcc-1_33_1.so.1.33.1
libboost_date_time-gcc.a
libboost_date_time-gcc-d-1_33_1.a
libboost_date_time-gcc-d-1_33_1.so
libboost_date_time-gcc-d-1_33_1.so.1.33.1
libboost_date_time-gcc-d.a
libboost_date_time-gcc-d.so
libboost_date_time-gcc-mt-1_33_1.a
libboost_date_time-gcc-mt-1_33_1.so
libboost_date_time-gcc-mt-1_33_1.so.1.33.1
libboost_date_time-gcc-mt.a
libboost_date_time-gcc-mt-d-1_33_1.a
libboost_date_time-gcc-mt-d-1_33_1.so
libboost_date_time-gcc-mt-d-1_33_1.so.1.33.1
libboost_date_time-gcc-mt-d.a
libboost_date_time-gcc-mt-d.so
libboost_date_time-gcc-mt.so
libboost_date_time-gcc.so

我在使用的时候应该具体链接那个呢?他们有什么区别?
...全文
360 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jixingzhong 2007-01-30
  • 打赏
  • 举报
回复
请看 官方文档 ~
doubhor 2007-01-30
  • 打赏
  • 举报
回复
应该是版本、调试信息等之间的取舍吧,
带mt的应该是支持多线程的吧(multi thread)
带d的应该是带debug信息的吧
iambic 2007-01-30
  • 打赏
  • 举报
回复
位置在:boost_1_33_1/more/getting_started.html
网上有文档,也有翻译过的,你可以再搜索下。

Results
The results of building come in to forms: static libraries, and dynamic libraries. Depending on the platform the libraries produced have different names to accommodate the platform requirements. For a single Boost library the build with the default will produce eight different libraries. For example building the Boost.Datetime library on Unix type system it would produce:

libboost_date_time-gcc-d-1_31.so
libboost_date_time-gcc-mt-d-1_31.so
libboost_date_time-gcc-1_31.so
libboost_date_time-gcc-mt-1_31.so
libboost_date_time-gcc-d-1_31.a
libboost_date_time-gcc-mt-d-1_31.a
libboost_date_time-gcc-1_31.a
libboost_date_time-gcc-mt-1_31.a

· Library Prefix

lib · Library Name

boost_date_time · Toolset

- gcc · Threading

- mt · Runtime

- d · Boost Version

- 1_31 · Library Type

.a

Library Prefix
The "lib" prefix on the libraries is a requirement on many platforms, like Unix, and on others like GCC running on Windows. The prefix is therefore added to all libraries on Unix type systems, and to static libraries on Windows. That is on Unix shared libraries and static libraries (object archives) are named respectively:

lib*.so
lib*.a
On Windows shared libraries do not have the prefix to differentiate the import libraries from static libraries. Consequently on Windows the libraries are named:

*.dll Dynamic library version.
*.lib Import library for the dll.
lib*.lib Static library version.



Library Name
For Boost libraries the name has the "boost_" prefix to separate them from other libraries in your system.

Toolset
The toolset name is an abbreviation based on the compiler you are building with. The abbreviation is composed of a short, 2 to 4 characters, tag for the compiler and a version number of the compiler's major and minor revision (if available). For example if your toolset is "gcc-3_2_3" the toolset tag would be "gcc32". The toolset abbreviations used are as follows:

TOOLS Name Abbreviation
borland bcb
como como
como-win32 como
cw cw
darwin osx
dmc dmc
dmc-stlport dmc
edg edg
gcc gcc
gcc-stlport gcc
gcc-nocygwin gcc
intel-linux il
intel-win32 iw
kcc kcc
kylix bck
mingw mgw
mingw-stlport mgw
mipspro mp
msvc vc
msvc-stlport vc
sunpro sw
tru64cxx tru
tru64cxx65 tru
vacpp xlc
vc7 vc
vc7-stlport vc
vc-7_1 vc
vc-7_1-stlport vc
vc-8_0 vc
Others The first part of the toolset name.

Threading
This tag indicates if the library is compiled with threading support. If threading is enabled "-mt" is added, otherwise nothing is added.

Runtime
This specifies the type of runtime the library was compiled against, and the type of code that is compiled. More commonly this encodes the ABI variation used in the code. For each feature of the runtime system and code compilation option a single letter is added to this tag.

Key Feature
s Static link to runtime.
g Debug runtime.
y Debug Python system.
d Debug enabled code.
p STLport runtime, instead of the vendor toolset runtime.
n STLport runtime using the "native" IO streams instead of the STLport IO streams.

For example if you compile debug code for STLport using native IO streams, and statically link to the debug runtime the tag would be: "-sgdpn".

Boost Version
This is the short label for the version of the Boost Libraries. The major and minor version numbers are taken together separated by an underscore. For example version 1.31.0 would be tagged as "-1_31". For patch versions the patch number is also included, for example a version of 1.31.1 would be tagged as "-1_31_1".

Library Type
The extension holds the type of library. This follows the platform requirements. On Windows this is ".dll" for shared libraries, and ".lib" for static libraries including import libraries. On Unix this is ".a" for static libraries (archives), and ".so" for shared libraries. For toolsets that support it in Unix they will also have a full version extension (for example ".so.1.31.0") with a symbolic link for the un-versioned library.
iambic 2007-01-30
  • 打赏
  • 举报
回复
看下boost文档里面Getting Started一部分。有比较详细的介绍。

64,318

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧