Posted on 2019-02-21 14:51
Prayer 閱讀(1201)
評論(0) 編輯 收藏 引用 所屬分類:
LINUX/UNIX/AIX 、
makefile
轉(zhuǎn)載于:http://www.cnblogs.com/lu-yang/archive/2011/11/24/2261282.html
在oc中經(jīng)常會遇到expected specifier-qualifier-list before sth之類得編譯錯(cuò)誤,造成這種錯(cuò)誤得主要原因就是使用了未被定義的變量。關(guān)于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未被完全定義即在定義中使用,這樣就會報(bào)錯(cuò),常規(guī)得解決辦法有: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在實(shí)際實(shí)驗(yàn)過程中會發(fā)現(xiàn)還會有一種方法可以解決此問題:假如有一個(gè)ParserDemo工程,而其中有ParserDemoAppDelegate.h/ParserDemoAppDelegate.m和ParserDemoViewController.h/ParserDemoViewController.m. 有時(shí)候?yàn)榱耸褂肅++代碼,經(jīng)常會將后者改為.mm但忘記將前者修改,這樣也會報(bào)類似的錯(cuò)誤,解決辦法很簡單,就是將二者都改成.mm即可。