WindowsでObjective-Cをコンパイルしてみた

けどできない。


<参考>
http://d.hatena.ne.jp/htz/20080806/1218009392
http://ameblo.jp/minagaki001/entry-10449455093.html


検索するとヒットした記事を参考にコンパイルしてみたが上手くいかないので書き残す。


環境は以下からファイルをダウンロードしてインストーラーでインストールするだけ。
リストとURLのファイル名が違うけどだいたいなんとかなる。

http://www.gnustep.org/experience/Windows.htmlから以下をダウンロードする

gnustep-system-0.19.2-setup.exe
gnustep-core-0.19.2-setup.exe
SystemPreferences-1.0.2-2-setup.exe
gorm-1.2.4-setup.exe
Calculator-1.0.0-2-setup.exe


コンパイル方法が謎かつ長いのでバッチに書いています。

@echo off
set HEADER=c:/GNUstep/GNUstep/System/Library/Headers
set LIB=c:/GNUstep/GNUstep/System/Library/Libraries
set OPT=-lobjc -lgnustep-base -fconstant-string-class=NSConstantString -enable-auto-import
echo Compiling Now %1
gcc -o %1 %1.m -I %HEADER% -L %LIB% %OPT%
echo Compiled.
pause


hello.c

#import <stdio.h>
#import <objc/Object.h>

@interface TestClass : Object
- (void) getMessage;
@end

@implementation TestClass
- (void) getMessage {
	printf("Hello Objective-C World\n");
}
@end

int main(int argc, char *argv[]) {
	id obj = [ TestClass alloc ];
	[ obj getMessage ];

	return 0;
}


コンパイルすると

Compiling Now hello
he_n.m: In function 'main':
he_n.m:15:2: warning: 'TestClass' may not respond to '+alloc' [enabled by defaul
t]
he_n.m:15:2: warning: (Messages without a matching method signature [enabled by
default]
he_n.m:15:2: warning: will be assumed to return 'id' and accept [enabled by defa
ult]
he_n.m:15:2: warning: '...' as arguments.) [enabled by default]
c:/gnustep/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: warning:
cannot find entry symbol nable-auto-import; defaulting to 00401000
Compiled.
続行するには何かキーを押してください . . .

実行ファイルは生成されているので実行するが、文字が出力されない。
コンパイルのWarning文がヒントをくれているので検索するとそれっぽい記事が出たけどあんま見てない。


Google翻訳すると、TestClassがallocに応答していない可能性があるらしい。
誰か原因教えてください。