下面的代码,编译的时候报错,也就是红色代码部分
MYHelloWorld.h:7:1:error:stray '@' in program
MYHelloWorld.m:5:1:error:stray '@' in program
#import <Foundation/Foundation.h>@interface MYHelloWorld : NSObject{
NSString* _userName;
}@property(nonatomic,retain)NSString* userName;- (id)initWithUserName:(NSString*)userName;
- (void)helloWorld;@end#import "MYHelloWorld.h"@implementation MYHelloWorld@synthesize userName = _userName;- (id)initWithUserName:(NSString *)userName{
self = [super init];
_userName = [userName copy];
return self;
}- (void)helloWorld{
NSString *text = [NSString stringWithFormat:@"%@,Hello World!",_userName];
printf([text UTF8String]);
}- (void)dealloc{
[_userName release];
[super dealloc];
}@end
MYHelloWorld.h:7:1:error:stray '@' in program
MYHelloWorld.m:5:1:error:stray '@' in program
#import <Foundation/Foundation.h>@interface MYHelloWorld : NSObject{
NSString* _userName;
}@property(nonatomic,retain)NSString* userName;- (id)initWithUserName:(NSString*)userName;
- (void)helloWorld;@end#import "MYHelloWorld.h"@implementation MYHelloWorld@synthesize userName = _userName;- (id)initWithUserName:(NSString *)userName{
self = [super init];
_userName = [userName copy];
return self;
}- (void)helloWorld{
NSString *text = [NSString stringWithFormat:@"%@,Hello World!",_userName];
printf([text UTF8String]);
}- (void)dealloc{
[_userName release];
[super dealloc];
}@end
解决方案 »
- 想学iphone开发 求一本比较好的OBJect-c语言书
- 点击登录按钮,跳转到登录的ViewController,为什么我的不跳转呢,帮忙看下
- 4个iphone游戏开发问题
- iOS开发:如何实现javascrip继承
- unity 3d 调用ios中的方法的问题 xcode 5 ios7 unity4.2.1(mac)
- ios上传NSData java服务端怎么接收
- 提交审核版本失败。不知道如何是好
- iOS tabbar 明明设置的title为什么运行的时候不显示
- ld: file not found: -lsqlite3
- 关于for循环中调用 dispatch_group_async
- ipad 硬件解码
- 微软正在客户端放弃.Net吗?兼谈monoTouch
self = [super init];
_userName = [userName copy];
return self;
}- (void)helloWorld{
NSString *text = [NSString stringWithFormat:@"%@,Hello World!",_userName];
printf([text UTF8String]);
}- (void)dealloc{
[_userName release];
[super dealloc];
}@end