如何使用独立的MingW在Windows下编译目标C程序 [英] How to compile an objective c program under windows with independant MingW
问题描述
我知道如何使用mingw的gnustep版本编译目标c程序.
I know how to compile the objective c program using gnustep version of mingw.
但是我不喜欢他们的shell,我想使用标准的mingw gcc编译器.
But I don't like their shell and I want to use the standard mingw gcc compiler.
我当然将此gcc bin目录放在环境路径中,在helloworld.m目录中打开命令提示符
I put this gcc bin directory in environment path of course, open command prompt in my helloworld.m directory
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog (@"Hello World!");
[pool drain];
return 0;
}
然后输入
gcc -o hello hello.m -I /GNUstep/System/Library/Headers -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base -fconstant-string-class=NSConstantString
但是它不起作用,因为它找不到基金会/基金会.
but it doesn't work because it cannot find foundation/foundation.h
如何解决此问题,并在可能的情况下避免在hello源代码中进行硬编码?
How to fix this and if possible avoid hardcoding in hello source code ?
推荐答案
Have a look here at the end of the post the blogger says to write:
gcc `gnustep-config --objc-flags` -o hello2 hello2.m -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base
似乎您总是必须通过GNUStep
It seems like you always have to pass through GNUStep
这篇关于如何使用独立的MingW在Windows下编译目标C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!