在cygwin下使用GCC正确地构建Objective-C代码是否可能?
我有一个应该在Mac环境中工作的应用程序,但是用gcc无法使最基本的东西工作。我需要安装更多的库吗?
#import "HelloWorldApp.h"
int main(int argc, char *argv[]) {
return 0;
} // End of the //
@interface Car
{
int test;
}
//The registration is a read-only field, set by copy
@property int (readonly, copy) test;
//the driver is a weak reference (no retain), and can be modified
//@property Person* (assign) driver;
@end
CC=gcc
CXX=gcc-g++
LD=$(CC)
CFLAGS=
LDFLAGS=-lobjc
all: HelloWorld
HelloWorld: HelloWorld.o
$(LD) $(LDFLAGS) -o $@ $^
%.o: %.m
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
clean:
rm -rvf *.o HelloWorld HelloWorld.exe
错误:
gcc -c HelloWorld.m -o HelloWorld.o
In file included from HelloWorld.m:6:
HelloWorldApp.h:19: error: stray '@' in program
HelloWorldApp.h:19: error: parse error before "int"
make: *** [HelloWorld.o] Error 1