【c++】error 某方法 declared as a 'virtual' field
来源:互联网 发布:淘宝客佣金扣除红包吗 编辑:程序博客网 时间:2024/04/30 00:45
参考 http://stackoverflow.com/questions/889581/why-c-compiler-gcc-thinks-function-is-virtual-field
I get that error when the first parameter doesn't make sense to it. Check thatEvaluator
is known as type:
struct A { virtual void* b(nonsense*, string*);};=> error: 'b' declared as a 'virtual' fieldstruct A { virtual void* b(string*, nonsense*);};=> error: 'nonsense' has not been declared
To find out whether something is a object or function declaration, the compiler sometimes has to scan the whole declaration. Any construct within the declaration that could possibly form a declaration is taken to be a declaration. If not, then any such construct is taken to be an expression. GCC apparently thinks because nonsense
is no valid type, it can't be a valid parameter declaration, and thus falls back treating the whole declaration as a field (note that it says in additionerror: expected ';' before '(' token
) . Same thing in local scope
int main() { int a; // "nonsense * a" not treated as declaration void f(nonsense*a);}=> error: variable or field 'f' declared voidint main() { // "nonsense * a" treated as parameter declaration typedef int nonsense; void f(nonsense*a);}=> (compiles successfully)
- 【c++】error 某方法 declared as a 'virtual' field
- 'xxx' declared as a 'virtual' field ----一个奇怪的C++bug
- c语言中[Error] variable or field 'CreatList' declared void错误原因分析
- When update to Xcode 5.1, an error occur '__curl_rule_01__' declared as an array with a negative siz
- __curl_rule_01__ declared as an array with a negative size
- '__curl_rule_01__'declared as an array with a negative size
- 出现This error can be caused by a virtual directory not being configured as an application...解决方法
- tag 'select', field 'list', name 'did': The requested list key '#dList' could not be resolved as a c
- tag 'select', field 'list', name 'did': The requested list key '#id' could not be resolved as a c
- ERROR [ValidatorFileParser] Attribute "short-circuit" must be declared forelement type "field-validator".
- Android Error:main cannot be resolved or is not a field 问题解决方法
- error C2894: templates cannot be declared to have 'C' linkage
- error C2894: templates cannot be declared to have 'C' linkage
- error C2894: templates cannot be declared to have 'C' linkage
- json_parser_read.hpp:257:264: error: ‘type name’ declared as function returning an array escape
- json_parser_read.hpp:257:264: error: ‘type name’ declared as function returning an array escape
- Why does a destructor in base class need to be declared virtual?
- 错误提示 the operation is not applicable to the current selection.Select a field which is not declared a
- Win7 CreateRemoteThread 另类使用方法
- 黑马程序员高级视频学习笔记IO输入输出流File类
- $(this).index() 值一直为-1
- Hibernate逍遥游记——(一)访问关系数据库
- SQL描述(4)
- 【c++】error 某方法 declared as a 'virtual' field
- "[ERROR] Could not find git path"
- centos6 安装chrome,wps
- [百度百科]英语状语
- oracle通过impdp导入不同表用户、不同表空间的数据
- Win7无线网卡分享wifi不稳定,手机连接总是自动断开,换这个网卡驱动就OK啦
- linux tty pty pts 概念 区别
- 二叉树非递归遍历
- 黑马程序员 面试题项目--银行业务调度系统