zaharpopov zaharpopov - 18 days ago 6
C++ Question

Boost.Asio as header-only

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.

Can I somehow use ASIO in project as only headers, without libs/source? I only need ASIO, not other part of Boost.

EDIT: ASIO want
Boost.System
which has a lib to link - can this dependency not be so that I can use header only ASIO?

Answer

AFAIK you can get the non-boost version of asio from http://think-async.com/Asio/AsioAndBoostAsio

"— 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 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."