c++ - error C2039: 'result_type' : is not a member of '`global namespace'' -


my app throwing error:

error c2039: 'result_type' : not member of '`global namespace'' 

for code:

void handle_read_headers(const boost::system::error_code& err, restclient::response& resp) {     if (!err)     {         // process response headers.         std::istream response_stream(&response_);         std::string header;         while (std::getline(response_stream, header) && header != "\r")             std::cout << header << "\n";         std::cout << "\n";          // write whatever content have output.         if (response_.size() > 0)             std::cout << &response_;          (&resp)->body = "yehey!!!";          // start reading remaining data until eof.         boost::asio::async_read(socket_, response_,         boost::asio::transfer_at_least(1),         boost::bind(&client::handle_read_content, this,         boost::asio::placeholders::error, boost::ref(resp)));      }     else     {         std::cout << "error: " << err << "\n";     } } 

the "bound" function looks this:

void handle_read_content(const boost::system::error_code& err, restclient::response& resp){} 

what wrong in code?

update:

i able compile code these changes

enter image description here

according documentation page readhandler needs take , error code as as number of bytes transferred.

it might msvc more picky/sensitive missing placeholders when invoking bind expression.¹

try adding placeholder parameter bind:

// start reading remaining data until eof. boost::asio::async_read(socket_, response_,         boost::asio::transfer_at_least(1),         boost::bind(&client::handle_read_content, this,             boost::asio::placeholders::error,             boost::asio::placeholders::bytes_transferred,             boost::ref(resp))); 

and handler function too:

void handle_read_content(const boost::system::error_code& ec, size_t bytes_transferred, restclient::response& resp){} 

update

i have spent unreasonable amounts of effort (thanks @qballer, @nab, , others on live feed too!) reproduce in visual studio , got this:

enter image description here

for record: was

  • win32
  • boost 1_58_0
  • openssl-1.0.2c-i386-win32
  • visual studio 2013 update 4

¹ in fact i've noticed asio accepts different signatures handler functions using gcc (my preferred compiler). i've wondered whether feature, or perhaps bug?


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

android - Pass an Serializable object in AIDL -