async_write方法错误
async_write method error
void Chat::Send(uint8_t* buffer, int length){
boost::asio::async_write(socket_,boost::asio::buffer(buffer,length),
boost::bind(&Chat:Send, this,boost::asio::placeholders::error));
}
它应该像本教程一样工作。但是当我尝试构建项目时,出现以下错误
Error 1 error C2825: 'F': must be a class or namespace when followed by '::' e:boost_1_46_1boost_1_46_1boostbindbind.hpp 69
Error 2 error C2039: 'result_type' : is not a member of '`global namespace'' e:boost_1_46_1boost_1_46_1boostbindbind.hpp 69
Error 3 error C2146: syntax error : missing ';' before identifier 'type' e:boost_1_46_1boost_1_46_1boostbindbind.hpp 69
Error 4 error C2208: 'boost::_bi::type' : no members defined using this type e:boost_1_46_1boost_1_46_1boostbindbind.hpp 69
Error 5 error C1903: unable to recover from previous error(s); stopping compilation e:boost_1_46_1boost_1_46_1boostbindbind.hpp 69
我什至没有使用"F",为什么它一直说"F":后跟"::"时必须是类或命名空间?
boost::bind(&Chat:Send, this,boost::asio::placeholders::error));
^^^^^^
应该是
boost::bind(&Chat::Send, this,boost::asio::placeholders::error));
^^^^^^
请注意类 Chat
的范围解析运算符。使用boost::bind
时可能遇到的编译器错误非常令人困惑。
相关文章:
- C++:正在检查LinkedList中的回文-递归方法-错误
- 如何确保在使用基于布尔值的两个方法之一调用方法时避免分支预测错误
- 方法内部但循环仍得到预期的不合格id错误C++
- 重载方法的方式会在使用临时调用时生成编译器错误
- 在C++中样板"冷/never_inline"错误处理技术的最佳方法是什么?
- 在C++中使用内联方法时出现未定义的符号错误
- 使用类模板的方法链接错误
- 尝试了解在导入的静态方法上使用删除方法时的错误
- 我的模板类方法返回错误类型?
- QtQuick - qml:28:错误:未知方法返回类型:自定义类型
- C++数组队列实现方法错误
- 方法错误"not all control paths return a value"和方法不返回值
- 为什么我的 setter 方法会产生错误的访问错误
- 派生类调用父类的方法,该方法调用重写的虚拟方法调用错误的方法
- 为什么调用没有正文的纯虚拟方法不会导致链接器错误?
- Android JNI 未定义对错误 c++ 方法的引用
- 这是哨兵线性搜索的错误方法吗?
- 这是重定向fork和execvp派生的子级的输出的错误方法吗
- flickcurl错误-方法flickr.oauth.access_token失败了
- 错误:方法未在此范围内声明(但已包含)