objective-c报错expecteinvalid identifierr,请帮忙看下,谢谢!

求救:expected identifier or ‘(’ before numeric constant - 查看主题 & Ubuntu中文论坛
&[ 5 篇帖子 ]&
&文章标题 : 求救:expected identifier or ‘(’ before numeric constant发表于 :
14:05帖子: 18
送出感谢: 0 次
gcc是不是出错了hello world文件#include &stdio.h& int main(void){
printf(&Hello, world!\n&);
return 0;}然后保存到hello.c再gcc hello.c结果就出现了hello.c:30:1: 错误: expected identifier or ‘(’ before numeric constant太奇怪了。请帮助,谢谢
&文章标题 : Re: 求救:expected identifier or ‘(’ before numeric constant发表于 :
14:05帖子: 18
送出感谢: 0 次
有遇到过同样问题的吗?
&文章标题 : Re: 求救:expected identifier or ‘(’ before numeric constant发表于 :
15:06帖子: 673
送出感谢: 0 次
吧你的代码复制过来。没有任何问题。
&文章标题 : Re: 求救:expected identifier or ‘(’ before numeric constant发表于 :
14:05帖子: 18
送出感谢: 0 次
mjp123 写道:吧你的代码复制过来。没有任何问题。难道是我的ubuntu的问题?
&文章标题 : Re: 求救:expected identifier or ‘(’ before numeric constant发表于 :
15:05帖子: 352
首先,请使用code标签。代码:#include&stdio.h&int main(void){& &printf(&Hello, world!\n&);& &return 0;}我怀疑是stdio.h 被改动了..看一下stdio.h第30行上下的内容。
显示帖子 : 全部帖子1天7天2周1个月3个月6个月1年&排序 作者发表时间文章标题 升序降序&
&[ 5 篇帖子 ]&
正在浏览此版面的用户:Bing [Bot] 和 2 位游客
您 不能 在这个版面发表主题您 不能 在这个版面回复主题您 不能 在这个版面编辑帖子您 不能 在这个版面删除帖子您 不能 在这个版面提交附件
选择一个版面
------------------
公告/注意事项
& &新闻和通知
& &校园社团支持
& && &华东校区
& && &华南校区
& && &华北校区
& && &华中校区
& && &东北校区
& && &西北校区
& && &港澳台校区
& && &国外校区
& &软件推荐
& &非常任务
系统安装区
& &教学和常见问答
& && &课堂教学和培训
& &初学者园地 - 17.04 - Zesty Zapus
& &系统安装和升级
& && &新立得和软件源
& && &Wubi安装讨论
& &启动和引导
& &网卡问题以及网络和拨号
& && &校园网拨号
& &笔记本、UMPC支持
& &手机和平板
& && &Ubuntu移动应用开发
& &常用硬件支持
& &系统架构支持
配置美化区
& &字体美化和中文支持
& && &个人配置文件存放点
& &桌面特效
& &窗口管理器
& &屏幕抓图
& &办公、图像、机械电子设计等
& && &Vim和Emacs
& &因特网相关软件
& &影音多媒体
& &Wine及其分支
& &游戏和游戏模拟器
& &虚拟机和虚拟化
& &其它类软件
& &开源模板库
服务器管理
& &服务器基础应用
& &数据库管理
& &服务器维护和硬件相关
& &Ubuntu VPS
参与Ubuntu开发
& &软件和文档翻译
& &编译或打包
& &Ubuntu错误报告
程序设计区
& &Shell脚本
& &GTK+和QT
& &软件/网站开发
& && &Python/Php/Perl
& && &C/C++/Java
& &内核及嵌入式开发
& &开源小工具
& &Ubuntu 17.10
& &Ubuntu 16.04 LTS
& &Ubuntu 14.04 LTS
& &Ubuntu 12.04 LTS
& &Ubuntu 10.04 LTS
& &老旧版本支持
& && &Ubuntu 15.10
& && &Ubuntu 15.04
& && &Ubuntu 14.10
衍生发行版
& &Ubuntu GNOME
& &Kubuntu
& &Xubuntu & Lubuntu
& &Ubuntu中文衍生版
& && &UbuntuKylin
& &Ubuntu国外衍生版
& && &Mint
& &Ubuntu衍生版制作
& &其它类Unix OS发行版
& && &Arch发行版
& && &Debian发行版
& && &OpenSUSE发行版
& && &Deepin
& &深度PK版
& &Ubuntu故事和感慨
& &Full Circle开源杂志
分享交流区
& &同城交流
& &线下活动专版
& &Ubuntu宣传推广
& &论坛管理
& && && &Ubuntu中文网上商店昨天把键盘拿起来拍一下清清灰,然后就发现Xcode报错了,,也不知道什么原因,可能是按到什么键了。在网上搜索了一下报错,说是把这个文件删除了重新把代码写一遍。但发现还是报错。
有一篇文章提到,说报错在一个文件,而出错在另一个文件,于是找了一下打开的另一个类文件,仔细看了一下,确实是多了个 &+ &号在文件最开始的地方,删了就解决了。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:120861次
积分:2113
积分:2113
排名:第16327名
原创:84篇
转载:66篇
评论:14条
(1)(5)(2)(4)(12)(4)(2)(10)(11)(5)(3)(1)(5)(5)(2)(1)(3)(23)(35)(17)Expected identifier in function declaration - Objective-C to Swift - Stack Overflow
Join the Stack Overflow Community
Stack Overflow is a community of 7.1 million programmers, just like you, helping each other.
J it only takes a minute:
I'm trying to convert over my Objective-C to Swift - a little confused on the error here and how to take care of it.
I've been reading through the documentation but still confused - this was generated from a converter.
Anyone have any ideas?
Objective-C
- (id) init
self = [super init];
if (!self)
self.cmRequestsQuery = [[NSMutableArray alloc] initWithCapacity:5];
self.cmQueryIsRuning = NO;
self.requestCounter = 0;
self.serverOfflineOrBadResponse = NO;
self.userWasLoggedIn = NO;
self.needToSendPushNotiToken = NO;
self.noInternetConection = NO;
self.needToUpdateToken = NO;
[[reqOperationManager sharedManager] setDelegate:self];
func init() -& AnyObject {
self = super()
if !self {
return nil
self.cmRequestsQuery = NSMutableArray(capacity: 5)
self.cmQueryIsRuning = false
self.requestCounter = 0
self.serverOfflineOrBadResponse = false
self.userWasLoggedIn = false
self.needToSendPushNotiToken = false
self.noInternetConection = false
self.needToUpdateToken = false
reqOperationManager.sharedManager().setDelegate(self)
return self
In Swift init methods have no func keyword and no return value and the point to call super is different.
First initialize all instance variables.
self.cmRequestsQuery = NSMutableArray(capacity: 5)
self.cmQueryIsRuning = false
self.requestCounter = 0
self.serverOfflineOrBadResponse = false
self.userWasLoggedIn = false
self.needToSendPushNotiToken = false
self.noInternetConection = false
self.needToUpdateToken = false
Then call super – if required – to get the instance.
super.init()
Then call the methods which use self
reqOperationManager.sharedManager().setDelegate(self)
That's it.
In some cases you have to add the override keyword before init().
For more details please read the chapter about Initialization in the Swift Language Guide. It's worth it.
66.1k75376
I had this problem because I was trying to import the swift header (import "ProjectName-swift.h") in my swift class.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
rev .25906
Stack Overflow works best with JavaScript enabled

我要回帖

更多关于 identifier 的文章

 

随机推荐