candidate expects 1 argument, 0 provided
来源:互联网 发布:爱卡自动发卡平台源码 编辑:程序博客网 时间:2024/06/05 08:30
Error Message
chunk.h: In constructor ‘Chunk::Chunk(muduo::net::EventLoop*, const muduo::net::InetAddress&, const muduo::net::InetAddress&)’:chunk.h:70:161: error: no matching function for call to ‘LengthHeaderCodec::LengthHeaderCodec()’ serverCodec_(boost::bind(&Chunk::onFileMessage, this, _1, _2, _3, _4)) ^chunk.h:39:14: note: candidate: LengthHeaderCodec::LengthHeaderCodec(const StringMessageCallback&) explicit LengthHeaderCodec(const StringMessageCallback &cb) : messageCallback_(cb) {} ^chunk.h:39:14: note: candidate expects 1 argument, 0 provided
遇到两次这种问题。第一次是之前我写了两个派生类继承了一个基类,后来实现感觉不合适,又改成回调的方式来实现,但是只取消了一个类的继承,另一个忘了取消,因为是回调的方式实现,自然不用再构造基类,但是第二个派生类我忘了取消继承,最后不停的报错。原因是它以为我调用了默认的构造函数,但基类没有默认的构造函数(实际上也不需要)。第二次是对于LengthHeaderCodec类,我声明了两个对象(serverCodec_, ClientCodec_)在类Chunk中,而LengthHeaderCodec类的构造函数是这样的```cppexplicit LengthHeaderCodec(const StringMessageCallback &cb) : messageCallback_(cb) {}```在我自己的需求中,ClientCodec_是不关注那个回调函数的事件的,所以我没有绑定,这样也就没有显式调用构造函数,那么也就调用了默认的构造函数,所以报错了
出现candidate expects xx argument, 0 provided这种情况,说明是可能是调用了默认的构造函数
阅读全文
0 0
- candidate expects 1 argument, 0 provided
- jni编译时出现:warning: format '%d' expects argument of type 'int', but argument 4 has
- MediaWiki 1.11.0 release candidate 1
- [C/C++]warning: format '%c' expects argument of type 'char*', but argument 2 has type 'int' [-Wforma
- inet_ntoa编译提示警告: 格式 ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat]
- g++编译报错原因分析 format ?.d?.expects argument of type ?.nt?. but argument 3 has type ?.
- linux c之提示format‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat
- Candidate
- inet_ntoa warning: format '%s' expects type 'char *', but argument 2 has type 'int'
- 编译告警:“warning: format '%d' expects type 'int', but argument 4 has type 'unsigned long'”
- 解决 format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘int *’
- warning: format ‘%s’ expects argument of type ‘char *’和warning: backslash and newline separated by
- VS 中error C2780: const _Ty &std::max(const _Ty &,const _Ty &,_Pr): expects 3 arguments - 2 provided
- ARGUMENT (1)
- Warning: flock() expects parameter 1 to be resource
- Warning: mysql_fetch_assoc() expects parameter 1 to be resource解决方法
- PHP Warning: mysql_num_rows() expects parameter 1 to be resource
- MySQL mysql_fetch_array() expects parameter 1 to be resource报错
- 树链剖分(合集)
- 栈和队列
- OpenGL学习:使用EBO索引绘图
- Pyinstaller Pmw
- ActiveMQ推拉模型与消息ACK
- candidate expects 1 argument, 0 provided
- hadoop2.7单机搭建
- 程序员的自我醒觉
- 从入门级到企业级:云服务器支持「共享型」升级「独享型」
- Android 实现水波纹效果
- Lexical error at line 15, column 17. Encountered: "\uff0c" (65292), after : ""
- 返回函数的自定义的不确定的参数的数组—func_get_args()和...$args
- weex 实现富文本
- 将二进制文件加入VC资源后释放执行