Skip to content
← Back to Community
How to use BOOST.Asio?
Profile icon
RDutch

Hello. I get this message: error: no type named 'io_context' in namespace 'boost::asio'; did you mean 'sigcontext'?
in this program code:

#include <boost / asio.hpp> int main () {boost :: asio :: io_context io;}

Repl with error here

How to correct use BOOST.Asio?

Voters
Profile icon
RDutch
Comments
hotnewtop
Profile icon
cinekqw1

just add depedency to nix
{ pkgs }: {
deps = [
pkgs.clang_12
pkgs.cmake
pkgs.gdb
pkgs.boost
];
}

Profile icon
xxpertHacker

Repl already has Boost downloaded, but I thought it was an older version.

I think your documentation is outdated, since they updated their API ~3 years ago: https://stackoverflow.com/questions/47895520/io-context-error-in-boost-library

Or maybe it's the other way around, I have no clue what version of Boost we have, but I wanted the newest version.

Profile icon
RDutch

@xxpertHacker I used this code on Visual Studio with latest BOOST 1.75.0 and it worked. I did everything according to the instructions from the official BOOST website: https://www.boost.org/doc/libs/1_75_0/doc/html/boost_asio/tutorial/tuttimer1.htm In Visual Studio, the code works, but in repl.it it does not

Profile icon
xxpertHacker

@RDutch Dang, I don't know. Guess it's the other way around then, Repl's Boost lib is older than 3 years; that'd make sense though, considering how their C++ compilers are outdated ~3 years.

I haven't actually put Boost to use for anything, since Repl's Boost lib is outdated and all requests for them to update it have been ignored.

I'll check out their tutorial tommorow and see if it can be made to work on Repl, but changes are that you'll need to use Repl's outdated lib.

Profile icon
RDutch

@xxpertHacker In Visual Studio it looks like this
image

Profile icon
SixBeeps

You actually need to install the library to use it.

Profile icon
RDutch

@SixBeeps I downloaded the boost_1_75_0.tar.gz archive and unpacked it. The result is a 700+ mb folder, what can I do with it? How do I install this folder to repl.it?

Profile icon
SixBeeps

@RDutch You have two options here. You may either upload the whole folder directly by dragging and dropping it to the Files pane, or you can put the tarball in there and extract it that way.

Though 700mb seems like a lot, and I'm not sure if a single Repl can handle that much. Especially it being a C++ library, I'm actually rather surprised it's that big.

Profile icon
RDutch

@SixBeeps The first option did not help, the error is the same. The second option does not work, because boost_1_75_0.tar.gz file does not load on repl.it
image

Profile icon
xxpertHacker

@SixBeeps Repl already has it.

Profile icon
RDutch

@xxpertHacker Then why doesn't it work?