首页 新闻 会员 周边 捐助

关于xcode的编译

0
[待解决问题]

代码如下

#import <Foundation/Foundation.h>

//类的声明

@interface Car : NSObject

{

    @public

    int wheels;//轮胎个数

    int speeds;//时速

}

 

@end

//类的实现

 

 

int main()

{

    //初始化类

    Car *p=[Car new];

    p->wheels=3;

    p->speeds=200;

    NSLog(@"轮子个数:%d,时速:%d",p->wheels,p->speeds);

    return 0;

}

仅仅就写了这么  在终端进行编译时候输入:cc 01.m  -framewrok Foundation 之后。提示如下错误:

Undefined symbols for architecture x86_64:

"_OBJC_CLASS_$_Car", referenced from:

objc-class-ref in 01第一个oc-e1972c.o

"_OBJC_IVAR_$_Car.speeds", referenced from:

_main in 01第一个oc-e1972c.o

"_OBJC_IVAR_$_Car.wheels", referenced from:

_main in 01第一个oc-e1972c.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

。低调ヽ继续的主页 。低调ヽ继续 | 菜鸟二级 | 园豆:205
提问于:2015-05-01 16:47
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册