|
Boost Users : |
Subject: [Boost-users] asio::async_write
From: Lloyd (lloyd_at_[hidden])
Date: 2009-11-18 00:12:36
Hi,
I have been trying very hard to "compile" this code. What is the reason
for the compilation errors in the "async_write" call.
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/asio.hpp>
using boost::asio::ip::tcp;
class aa
{
public:
void testme()
{
char a[20]="<test data>";
boost::asio::io_service io;
tcp::socket s(io);
boost::asio::async_write(s,boost::asio::buffer(a,sizeof(a)),
boost::bind(&aa::handler,shared_from_this(),boost::asio::placeholders::error));
}
void handler(const boost::system::error_code& error)
{
}
private:
};
int main()
{
aa x;
x.testme();
return 0;
}
The erros I got are:
====================
1>------ Build started: Project: del, Configuration: Release Win32 ------
1>Compiling...
1>del.cpp
1>.\del.cpp(19) : error C2780: 'void
boost::asio::async_write(AsyncWriteStream
&,boost::asio::basic_streambuf<Allocator>
&,CompletionCondition,WriteHandler)' : expects 4 arguments - 3 provided
1> C:\Program Files\boost140\boost/asio/write.hpp(510) : see
declaration of 'boost::asio::async_write'
1>.\del.cpp(19) : error C2784: 'void
boost::asio::async_write(AsyncWriteStream
&,boost::asio::basic_streambuf<Allocator> &,WriteHandler)' : could not
deduce template argument for 'boost::asio::basic_streambuf<Allocator> &'
from 'boost::asio::mutable_buffers_1'
1> C:\Program Files\boost140\boost/asio/write.hpp(453) : see
declaration of 'boost::asio::async_write'
1>.\del.cpp(19) : error C2784: 'void
boost::asio::async_write(AsyncWriteStream
&,boost::asio::basic_streambuf<Allocator> &,WriteHandler)' : could not
deduce template argument for 'boost::asio::basic_streambuf<Allocator> &'
from 'boost::asio::mutable_buffers_1'
1> C:\Program Files\boost140\boost/asio/write.hpp(453) : see
declaration of 'boost::asio::async_write'
1>.\del.cpp(19) : error C2780: 'void
boost::asio::async_write(AsyncWriteStream &,const ConstBufferSequence
&,CompletionCondition,WriteHandler)' : expects 4 arguments - 3 provided
1> C:\Program Files\boost140\boost/asio/write.hpp(411) : see
declaration of 'boost::asio::async_write'
1>.\del.cpp(19) : error C3861: 'shared_from_this': identifier not found
1>Build log was saved at "file://c:\Documents and
Settings\Administrator\Desktop\del\del\Release\BuildLog.htm"
1>del - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
______________________________________
Scanned and protected by Email scanner
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net