win7环境下,通过一系列安装等得到MINGW32下的Shell,

这个Shell等同于linux下的终端,可以用ls-a,等命令测试下是否工作正常。

如果一个.m文件存在D:/App/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;
}

在Shell中

cd D:

cd App:

gcc -o helloworld helloworld.m -I /GNUstep/System/Library/Headers -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base -fconstant-string-class=NSConstantString

上面这行语句可以在这个网页看到http://www.jaysonjc.com/programming/objective-c-programming-in-windows-gnustep-projectcenter.html

上面这个命令可以写成bat执行,就不用每次都用DOS窗口写,比较省事了。

Shell中执行gcc -o ......后

执行 ./helloworld

得到输出结果 HelloWorld!

相关文章:

  • 2022-12-23
  • 2021-08-16
  • 2021-06-11
  • 2021-07-14
  • 2021-10-28
  • 2021-11-04
  • 2022-12-23
  • 2021-09-04
猜你喜欢
  • 2022-12-23
  • 2021-08-31
  • 2022-02-25
  • 2021-08-01
  • 2022-12-23
  • 2021-12-06
  • 2021-12-26
相关资源
相似解决方案