如何在windows下用独立的MingW编译一个objective c程序
我知道如何使用 mingw 的 gnustep 版本编译目标 c 程序。
但我不喜欢他们的 shell,我想使用标准的 mingw gcc 编译器。
当然,我将此 gcc bin 目录放在环境路径中,在 helloworld.m 目录中打开命令提示符
#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
但它不起作用,因为它找不到 Foundation/foundation.h
如何解决此问题,如果可能的话,避免在 hello 源中进行硬编码代码 ?
I know how to compile the objective c program using gnustep version of mingw.
But I don't like their shell and I want to use the standard mingw gcc compiler.
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;
}
and type
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
How to fix this and if possible avoid hardcoding in hello source code ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请查看此处博主说要写的帖子结尾:
看来你总是必须通过GNUStep
Have a look here at the end of the post the blogger says to write:
It seems like you always have to pass through GNUStep
我遇到了同样的问题。像下面这样修改命令行解决了我的问题。
I had the same problem.Modifying command line like below solved my problem.