【发布时间】:2014-03-13 13:32:56
【问题描述】:
我正在尝试编译我的第一个 Objective-C 程序。这只是简单的“编程很有趣!”代码:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog (@"Programming is fun!");
[pool drain];
return 0;
}
我下载了 gnustep-msys-system-0.30.0-setup.exe 和 gnustep-core-0.34.0-setup.exe 并按顺序安装它们。我将名为 prg1.m 的文件(包含前面的代码)复制到 /GNUstep/msys/1.0/home/username 文件夹中。我打开了 GNUstep shell 并继续发出以下命令:
gcc -o prg1 prg1.m -I /GNUstep/System/Library/Headers -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base -fconstant-string-class=NSConstantString
我得到以下输出:
In file included from C:/GNUstep/GNUstep/System/Library/Headers/GNUstepBase/GSCo
nfig.h:281:0,
from C:/GNUstep/GNUstep/System/Library/Headers/GNUstepBase/GSVe
rsionMacros.h:219,
from C:/GNUstep/GNUstep/System/Library/Headers/Foundation/Found
ation.h:30,
from prg1.m:1:
c:\mingw\include\w32api.h:27:2: warning: #warning WARNING - The w32api.h header
file is deprecated and will be removed. [-Wcpp]
#warning WARNING - The w32api.h header file is deprecated and will be removed.
^
In file included from C:/GNUstep/GNUstep/System/Library/Headers/Foundation/NSPor
tMessage.h:30:0,
from C:/GNUstep/GNUstep/System/Library/Headers/Foundation/Found
ation.h:99,
from prg1.m:1:
C:/GNUstep/GNUstep/System/Library/Headers/Foundation/NSPort.h:210:3: error: unkn
own type name 'WSAEVENT'
WSAEVENT eventListener;
^
有人知道为什么我最后会收到此错误吗?我已经在谷歌上搜索了几个小时,但运气不佳。任何帮助将不胜感激。提前致谢。
【问题讨论】:
-
您以前安装过 MinGW 吗?我刚刚全新安装了
GNUstep MSYS System 0.30.0, GNUstep Core 0.34.0 and GNUstep Devel 1.4.0,但无法重现您的问题。这行c:\mingw\include\w32api.h也不对应我的安装路径:C:GNUstep\include\w32api.h -
就是这样。现在我可以停止用头撞墙了。我之前在不同的文件夹中安装了 MinGw,我的 Path 语句指向它。非常感谢。
-
尝试使用 gnustep-make 包构建。最好在 GNUstep 邮件列表上提问。
标签: objective-c gcc gnustep