Problems with reading into buffer using boost::asio::async_read
- by Max
Good day.
I have a Types.hpp file in my project. And within it i have:
....
namespace RC
{
.....
.....
struct ViewSettings
{
....
};
.....
}
In the Server.cpp file I'm including this Types.hpp file, and i have there:
class Session
{
.....
RC::ViewSettings tmp;
boost::asio::async_read(socket_, boost::asio::buffer(&tmp, sizeof(RC::ViewSettings)),
boost::bind(&Session::Finish_Reading_Data, shared_from_this(), boost::asio::placeholders::error));
.....
}
And during the compilation i have an errors:
error C2825: 'F': must be a class or namespace when followed by '::'
: see reference to class template instantiation 'boost::_bi::result_traits<R,F>'
being compiled with
[
R=boost::_bi::unspecified,
F=void (__thiscall Session::* )(void)
]
: see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>'
being compiled with
[
R=boost::_bi::unspecified,
F=void (__thiscall Session::* )(void),
L=boost::_bi::list2<boost::_bi::value<boost::shared_ptr<Session>>,boost::arg<1>>
]
error C2039: 'result_type' : is not a member of '`global namespace''
And the code like this works in proper way:
int w;
boost::asio::async_read(socket_, boost::asio::buffer(&w, sizeof(int)),
boost::bind(&Session::Handle_Read_Width, shared_from_this(), boost::asio::placeholders::error));
Please, help. What's the problem here?
Thanks in advance.