编译Objective-C程序时出错

编译Objective-C程序时出错,objective-c,gcc,gnustep,Objective C,Gcc,Gnustep,我正试图编译我的第一个Objective-C程序。只是简单的编程很有趣!代码: #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSLog (@"Programming is fun!"); [pool drain];

我正试图编译我的第一个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;  
}  
我得到以下输出:

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;
   ^

有人知道我最后为什么会犯这个错误吗?我在谷歌上搜索了几个小时,运气不太好。任何帮助都将不胜感激。提前感谢。

您的问题似乎在您下载的foundation/foundation.h库中。这里真正的问题是,当你下载了一个.exe文件时,你似乎正在使用一台电脑,因此我想知道,你为什么用Objective-C编程?唯一仍然使用Objective-C的平台是iOS/Apple平台,如果没有苹果电脑,你真的无法有效地编写代码。如果你只是想学习Objto-C因为你计划进入iOS,那么我明白了,但是如果你不打算这样做,那么没有理由学习ObjuleC,你最好学习java、C++或C++。p>
对于您的问题,更具体的答案是WSAEVENT是windows线程中使用的一个信号。很可能您的系统找不到对它的正确支持,这可能是因为w32api.h被删除,其中引用了WSAEVENT所在的位置

他说他使用的是gnustep,这是一个用于ObjC的苹果框架的端口,所以这不是问题。事实上,你提到iOS/苹果的东西有点可笑。我之所以要看Objective-C,是因为我最近开始的工作有一堆用Objective-C编写的旧代码,它们都在Windows环境中运行。我还想知道他们为什么使用Objective-C,我刚听说它是很久以前写的。我的工作不需要学习这个,但它会很有用。仅仅因为他使用的是一个框架并不意味着它工作正常。他下载的版本、他构建它的方式、他的系统设置或许多其他东西可能会有问题,所以将其视为一个问题是完全公平的。不幸的是,我们常常只剩下旧代码。如果你不能让它工作,你可以做的另一件事就是看看闲聊。Objective-C是以类似的方式构建的,因此如果您了解C和Smalltalk,您将了解Objective-C。了解Smalltalk和C不会自动使您了解Objective-C。例如,旧代码中的内存管理。您以前安装过MinGW吗?我刚刚重新安装了gnustepmsys系统0.30.0、gnustepcore 0.34.0和gnustepdevel1.4.0,我无法重现您的问题。另外,这一行c:\mingw\include\w32api.h与我的安装路径c:GNUstep\include\w32api.h不对应。它是什么。现在我可以不再把头撞在墙上了。我之前在另一个文件夹中安装了MinGw,我的Path语句指向它。非常感谢。尝试使用gnustepmake包来构建。最好在GNUstep邮件列表上询问。
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;
   ^