这是xcode6.3里的代码:
#import
int main()
{
NSlog(@"第一个OC程序!!!");
return 0;
}
用Mac 自带的终端编译后:
zhuxunandeMac-mini:OC语言程序 shukyokunan$ cc -c 第一个OC程序.m
第一个OC程序.m:5:5: warning: implicit declaration of function 'NSlog' is
invalid in C99 [-Wimplicit-function-declaration]
NSlog(@"第一个OC程序!!!");
^
1 warning generated.
zhuxunandeMac-mini:OC语言程序 shukyokunan$ cc 第一个OC程序.o -framework Foundation
Undefined symbols for architecture x86_64:
"_NSlog", referenced from:
_main in 第一个OC程序.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
zhuxunandeMac-mini:OC语言程序 shukyokunan$
总是报错