开发者

How to find out if a Boost header can be used as header-only or not?

I am using the Boost headers in my project which is compiled by g++. I downloaded the Boost source and didn't build it so there are no library files to link.

When I read the Boost website (http://ww开发者_如何转开发w.boost.org/doc/libs/1_40_0/) it says Boost.Thread requires its corresponding library, but I am happily using the <boost/thread/mutex.hpp>(boost::mutex) header without linking to the Boost thread library.

How do I really tell whether I need to link the corresponding library for using a particular Boost header file or not?


In a Terminal:

./bootstrap.sh --show-libraries

The output shows the list of libraries requiring special build and installation.


The Boost documentation states whether a given library is header only or not. If you're using a library which isn't specified header only, and are not linking against the corresponding library, it's undefined behavior.

The fact that it happens to work (or seems to work) isn't really relevant.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜