我刚开始做gcc的Objective-C(到目前为止我只使用XCode)。Gcc不包括Object.h
#include <objc/Object.h>
@interface Integer : Object
{
int integer;
}
- (int) integer;
-(id) integer: (int) _integer;
@end
#import "Integer.h"
@implementation Integer
- (int) integer
{
return integer;
}
- (id) integer: (int) _integer
{
integer = _integer;
}
@end
我也曾经尝试编译的东西,我得到这个:
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
列入没有相当的工作。 我搜索你包括Object.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’`\
我在忽略什么?
对象已经从... 1995年弃用? – bbum 2011-02-07 22:34:43