Boost.Asio as header-only(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."
这篇关于Boost.Asio 作为仅标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Boost.Asio 作为仅标头
基础教程推荐
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- CString 到 char* 2021-01-01
