我正在编译我的第一个Objective-C程序。这只是简单的“编程很有趣!”代码:编译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系统-0.30.0-setup.exe并GNUstep的核心-0.34.0-setup.exe并按照这个顺序安装它们。我将名为prg1.m(包含前面的代码)的文件复制到/GNUstep/msys/1.0/home/username文件夹中。我打开GNUstep的外壳,并着手发出以下命令:
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;
^
任何人都知道为什么,我在最后得到这个错误?我一直在Google上搜索几个小时,但没有多少运气。任何帮助将不胜感激。提前致谢。
您是否曾经安装过MinGW?我刚刚安装了GNUstep MSYS System 0.30.0,GNUstep Core 0.34.0和GNUstep Devel 1.4.0,我无法重现你的问题。此行'c:\ mingw \ include \ w32api.h'不对应于我的安装路径:'C:GNUstep \ include \ w32api.h' – Emmanuel
就是这样。现在我可以放弃对着墙壁的撞击了。我之前曾在另一个文件夹中安装了MinGw,并且我的Path语句指向它。谢谢一堆。 – TheGump
尝试使用gnustep-make包进行构建。在GNUstep邮件列表上询问是个好主意。 –