0
votes

I am following This tutorial for boost SSL. The only thing I did that was not done on that tutorial is put each class into its own files. I have no clue where this is being thrown so its a hard one for me to debug.

error C2248: 'boost::asio::detail::noncopyable::noncopyable' : cannot access private member declared in class 'boost::asio::detail::noncopyable'

1
The error says it all. You are prevented from copying that specific Boost.Asio object. - Mark Garcia
Maybe you forgot to store io_service by reference instead of by value? Impossible to tell without looking at your code - nijansen
Which line is the error pointing to? - avakar
@avakar it doesn't point to any of my code. It points to io_service.hpp in boost - Shredder2500
@nijansen you were right post that as an answer and ill check it - Shredder2500

1 Answers

2
votes

A common error when working with Boost.Asio is that boost::asio::io_service is non-copyable, so you may only store references to it in your classes:

struct foo
{
    foo(boost::asio::io_service & io_service)
        : io_service_(io_service)
    {}

    private:
        boost::asio::io_service & io_service_;    // ok
};

If you declared boost::asio::io_service io_service_ instead, you get the error stated above, because the initialization io_service_(io_service) depends on the copy constructor being called.