本帖最后由 行我福 于 2015-1-24 20:38 编辑
第一个oc程序很简单啊,应该没有问题源代码就是很简单的这种:- #import <Foundation/Foundation.h>
- int main()
- {
- NSLog(@"The first programe !!!!");
- return 0;
- }
复制代码
死活不能链接通过gongjiahaodeMac:oc Jiahao$ cc -c first.m gongjiahaodeMac:oc Jiahao$ cc first.o Undefined symbols for architecture x86_64: "_NSLog", referenced from: _main in first.o "___CFConstantStringClassReference", referenced from: CFString in first.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) gongjiahaodeMac:oc Jiahao$ cc first.o -v Apple LLVM version 5.0 (clang-500.2.78) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix "/Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -syslibroot "/Applications/Xcode 2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" -o a.out first.o -lSystem "/Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a" Undefined symbols for architecture x86_64: "_NSLog", referenced from: _main in first.o "___CFConstantStringClassReference", referenced from: CFString in first.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) |