Objective c Gcc不包括Object.h
我刚刚开始用gcc做objective-c(到目前为止我只使用XCode) 一旦我尝试编译这些东西,我就会得到:Objective c Gcc不包括Object.h,objective-c,gcc,Objective C,Gcc,我刚刚开始用gcc做objective-c(到目前为止我只使用XCode) 一旦我尝试编译这些东西,我就会得到: main.m: In function ‘main’: main.m:8: warning: ‘Integer’ may not respond to ‘+new’ main.m:8: warning: (Messages without a matching method signature main.m:8: warning: will be assumed to r
main.m: In function ‘main’:
main.m:8: warning: ‘Integer’ may not respond to ‘+new’
main.m:8: warning: (Messages without a matching method signature
main.m:8: warning: will be assumed to return ‘id’ and accept
main.m:8: warning: ‘...’ as arguments.)
main.m:8: warning: ‘Integer’ may not respond to ‘+new’
在我看来,包含Object.h
并没有完全起作用。
我在你身上搜索了物品h,得到了这个:
find /usr/include/ -name Object.h
/usr/include//objc/Object.h
GCC输出还提示编译器实际上正在该路径中搜索
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
GNU Objective-C version 4.2.1 (Apple Inc. build 5664) (i686-apple-darwin10)
compiled by GNU C version 4.2.1 (Apple Inc. build 5664).
GGC heuristics: --param ggc-min-expand=150 --param ggc-min-heapsize=131072
Compiler executable checksum: 84137cc00ce86c64ee80a91a006f61ae
main.m: In function ‘main’:
main.m:8: warning: ‘Integer’ may not respond to ‘+new’
main.m:8: warning: (Messages without a matching method signature
main.m:8: warning: will be assumed to return ‘id’ and accept
main.m:8: warning: ‘...’ as arguments.)
main.m:8: warning: ‘Integer’ may not respond to ‘+new’`\
#包括“…”搜索从这里开始:
#包括搜索从这里开始:
/usr/本地/包括
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include
/usr/包括
/系统/库/框架(框架目录)
/库/框架(框架目录)
搜索列表结束。
GNU Objective-C版本4.2.1(苹果公司生产5664)(i686-Apple-darwin10)
由GNU C版本4.2.1(苹果公司构建5664)编译。
GGC启发式:--param GGC min expand=150--param GGC min heapsize=131072
编译器可执行校验和:84137cc00ce86c64ee80a91a006f61ae
main.m:在函数“main”中:
main.m:8:警告:“整数”可能不响应“+new”
main.m:8:warning:(没有匹配方法签名的消息)
main.m:8:警告:将假定返回“id”并接受
main.m:8:警告:“…”作为参数。)
main.m:8:警告:“整数”可能不响应“+new”`\
我忽略了什么?如果gcc找不到Object.h,它会给出一个错误提示。问题在于,苹果在Objective-C2.0中删除了对象(或者至少是它的接口)中的大部分方法。相反,您应该将NSObjor子类包括基础框架。
如何将第一行更改为
#include <objc/Object>
我刚听说Object.h在OSX中已经很坏了。自从。。。1995?
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
GNU Objective-C version 4.2.1 (Apple Inc. build 5664) (i686-apple-darwin10)
compiled by GNU C version 4.2.1 (Apple Inc. build 5664).
GGC heuristics: --param ggc-min-expand=150 --param ggc-min-heapsize=131072
Compiler executable checksum: 84137cc00ce86c64ee80a91a006f61ae
main.m: In function ‘main’:
main.m:8: warning: ‘Integer’ may not respond to ‘+new’
main.m:8: warning: (Messages without a matching method signature
main.m:8: warning: will be assumed to return ‘id’ and accept
main.m:8: warning: ‘...’ as arguments.)
main.m:8: warning: ‘Integer’ may not respond to ‘+new’`\
#include <objc/Object>