Boost.Asio 作为仅标头
我想在我的项目中使用来自 Boost 的 ASIO 库.它的文档说如果不使用正则表达式并且不使用 SSL,它可以是仅标头.但是,为 asio
运行 bcp
会拉取很多库,其中一些库有源代码,因此需要编译,bjam
等.
I want to use ASIO library from Boost in my project. Its doc say it can be header-only if regex is not used and SSL not used. However, running bcp
for asio
pulls a very many libraies some of which are with sources so need compiling, bjam
etc.
我可以以某种方式在项目中仅将 ASIO 用作标头,而无需库/源吗?我只需要ASIO,不需要Boost的其他部分.
Can I somehow use ASIO in project as only headers, without libs/source? I only need ASIO, not other part of Boost.
ASIO 想要 Boost.System
有一个要链接的库 - 这个依赖不能让我只能使用头文件 ASIO?
ASIO want Boost.System
which has a lib to link - can this dependency not be so that I can use header only ASIO?
推荐答案
AFAIK 你可以从 http://think-async.com/Asio/AsioAndBoostAsio
AFAIK you can get the non-boost version of asio from http://think-async.com/Asio/AsioAndBoostAsio
"――Boost.Asio 使用 Boost.System 库来提供对错误代码的支持(boost::system::error_code 和 boost::system::system_error).Asio 将这些包含在它自己的命名空间(asio::error_code和 asio::system_error).这些类的 Boost.System 版本目前支持更好的用户定义错误代码的可扩展性.
"― Boost.Asio uses the Boost.System library to provide support for error codes ( boost::system::error_code and boost::system::system_error). Asio includes these under its own namespace ( asio::error_code and asio::system_error). The Boost.System version of these classes currently supports better extensibility for user-defined error codes.
――Asio 仅是头文件,大多数情况下不需要链接到任何 Boost 库.Boost.Asio 总是要求您链接到 Boost.System 库,如果您想使用 boost::thread 启动线程,也需要链接到 Boost.Thread."
― Asio is header-file-only and for most uses does not require linking against any Boost library. Boost.Asio always requires that you link against the Boost.System library, and also against Boost.Thread if you want to launch threads using boost::thread."
相关文章