[asio] Strange compilation error

Hi there I'm experiencing a strange compilation error that I cannot
resolve myself.
The following non-functionating triggers the error. I'm using VC2003
SP1. The error is due to the write() call.
template <class T > void sent( const T& object )
{
std::ostringstream archive_stream;
boost::archive::binary_oarchive archive( archive_stream );
archive & object;
std::string outbound_data = archive_stream.str();
// Format the header.
std::ostringstream header_stream;
header_stream << std::setw( 8 )
<< std::hex
<< outbound_data.size();
std::string outbound_header = header_stream.str();
// Write the serialized data to the socket. We use "gather-write" to send
// both the header and the data in a single write operation.
std::vectorboost::asio::const_buffer buffers;
buffers.push_back(boost::asio::buffer(outbound_header));
buffers.push_back(boost::asio::buffer(outbound_data));
boost::asio::write( socket, buffers );
}
This is the verbose error message:
..\..\..\External\Includes\Boost\asio\impl\write.ipp(40) : error
C2825: 'Sync_Write_Stream::error_type': cannot form a qualified name
..\..\..\External\Includes\Boost\asio\impl\write.ipp(58) : see
reference to function template instantiation 'size_t
boost::asio::write

Hi Christian,
Christian Henning
Hi there I'm experiencing a strange compilation error that I cannot resolve myself.
boost::asio::write( socket, buffers );
It's not clear where your code expects the variable 'socket' to come from. The compiler thinks it refers to the function socket(), which is why the error includes this:
Sync_Write_Stream=SOCKET (int,int,int),
Cheers, Chris

Yep, my fault. Sorry.
On 9/16/06, Christopher Kohlhoff
Hi Christian,
Christian Henning
writes: Hi there I'm experiencing a strange compilation error that I cannot resolve myself.
boost::asio::write( socket, buffers );
It's not clear where your code expects the variable 'socket' to come from. The compiler thinks it refers to the function socket(), which is why the error includes this:
Sync_Write_Stream=SOCKET (int,int,int),
Cheers, Chris
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Christian Henning
-
Christopher Kohlhoff