error:- expected ';' at the end of the declaration list
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
float number; error:- expected ';' at the end of the declaration list
float result;
int currentoperation;
__weak IBOutlet UILabel *label;
}
- (IBAction)canceloperation:(id)sender;
- (IBAction)cancelnumber:(id)sender;
- (IBAction)buttonoperation:(id)sender;
- (IBAction)buttonnumber:(id)sender;
@end
请修复此代码。
发布于 2014-06-30 21:38:06
OP的问题说得很糟糕,但这里确实存在一个问题。
当Xcode C Language Dialect
设置为C99
而不是GNU99
时,就会出现问题。C99没有对typeof()
的声明,并将假定它返回int
。然后,会记录以下一堆令人困惑的错误消息:
warning: type specifier missing, defaults to 'int'
__weak typeof(self) weakSelf = self;
~~~~~~ ^
'__weak' only applies to Objective-C object or block pointer types; type here is 'int'
__weak typeof(self) weakSelf = self;
^
a parameter list without types is only allowed in a function definition
__weak typeof(self) weakSelf = self;
^
expected ';' at end of declaration
__weak typeof(self) weakSelf = self;
^
要改变这一点:打开Project Navigator >单击项目>单击目标>选择C语言方言>按backspace设置默认值。
发布于 2013-06-09 02:32:50
这是许多“看不见的字符”问题的重复。你的代码中有一个看不见的字符。
如果您有使用emacs或使用ctrl键的历史,您可以很容易地点击ctrl-return并插入一个不可见的字符。
http://www.friday.com/bbum/2012/12/23/xcode-sometimes-a-return-is-not-a-return-emacs-brain-damage/
https://stackoverflow.com/questions/16999749
复制相似问题