首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >声明列表末尾应为';‘

声明列表末尾应为';‘
EN

Stack Overflow用户
提问于 2013-06-08 20:58:45
回答 2查看 6.2K关注 0票数 0
代码语言:javascript
运行
复制
error:- expected ';' at the end of the declaration list
代码语言:javascript
运行
复制
#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

请修复此代码。

EN

回答 2

Stack Overflow用户

发布于 2014-06-30 21:38:06

OP的问题说得很糟糕,但这里确实存在一个问题。

当Xcode C Language Dialect设置为C99而不是GNU99时,就会出现问题。C99没有对typeof()的声明,并将假定它返回int。然后,会记录以下一堆令人困惑的错误消息:

代码语言:javascript
运行
复制
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设置默认值。

票数 25
EN

Stack Overflow用户

发布于 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/

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16999749

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档