Posted on 2019-02-21 14:51
Prayer 阅读(1115)
评论(0) 编辑 收藏 引用 所属分类:
LINUX/UNIX/AIX 、
makefile
转载于:http://www.cnblogs.com/lu-yang/archive/2011/11/24/2261282.html
在oc中经常会遇到expected specifier-qualifier-list before sth之类得编译错误,造成这种错误得主要原因就是使用了未被定义的变量。关于specifier-qualifier-list的定义:It's a list of specifiers and qualifiers :-) Specifiers are things like void, char, struct Foo, etc., and qualifiers are keywords like const and volatile. See this C grammar for the definition.如:
typedef struct { char *key; long canTag; long canSet; long allowMultiple; confType *next; } confType;
由于confType未被完全定义即在定义中使用,这样就会报错,常规得解决办法有:1.
typedef struct confType { char *key; long canTag; long canSet; long allowMultiple; struct confType*next; } confType;
2.
typedef structconfType confType; struct confType { char *key; long canTag; long canSet; long allowMultiple; confType *next; };
上述例子可参考http://stackoverflow.com/questions/2894639/what-is-a-specifier-qualifier-listhttp://stackoverflow.com/questions/3888569/expected-specifier-qualifier-list-before在实际实验过程中会发现还会有一种方法可以解决此问题:假如有一个ParserDemo工程,而其中有ParserDemoAppDelegate.h/ParserDemoAppDelegate.m和ParserDemoViewController.h/ParserDemoViewController.m. 有时候为了使用C++代码,经常会将后者改为.mm但忘记将前者修改,这样也会报类似的错误,解决办法很简单,就是将二者都改成.mm即可。