0
votes

I am trying to compile my first Objective-C program. It is just the simple "Programming is fun!" code:

#import <Foundation/Foundation.h>  
int main (int argc, const char * argv[])  
{  
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];      
  NSLog (@"Programming is fun!");  
  [pool drain];     
  return 0;  
}  

I downloaded the gnustep-msys-system-0.30.0-setup.exe and gnustep-core-0.34.0-setup.exe and installed them in that order. I copied the file named prg1.m (which contain the previous code) to the /GNUstep/msys/1.0/home/username folder. I opened the GNUstep shell and proceeded to issue the following command:

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

I get the following output:

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

Anyone know why I am getting this error at the end? I have been googling it for a couple of hours without much luck. Any help would be greatly appreciated. Thanks in advance.

1
Do you have a previous installation of MinGW ? I just did a fresh installation of GNUstep MSYS System 0.30.0, GNUstep Core 0.34.0 and GNUstep Devel 1.4.0 and i can't reproduce your problem. Also this line c:\mingw\include\w32api.h do not correspond to my installation path : C:GNUstep\include\w32api.h - Emmanuel
That was it. Now I can quit pounding my head against a wall. I had earlier installed MinGw in a different folder and my Path statement was pointing to it. Thanks a bunch. - TheGump
Try to use gnustep-make package to build. And it's a better idea to ask on GNUstep mailing list. - Fred Frith-MacDonald

1 Answers

-4
votes

The issue you have seems to be in the foundation/foundation.h library you downloaded. The real question here is it seems you are using a PC as you downloaded a .exe thus I wonder, why are you programing in Objective-C? The only platform that still uses Objective-C is the iOS/Apple platform which you really can not effectively code for with out an Apple computer. If you just want to learn Objective-C because you plan to get into iOS soon then I understand but if you do not plan to do this then there is no reason to learn Objective-C, you are better off learning Java, C# or C++.

The more specific answer to your question is that WSAEVENT is a signal used in windows threads. Chances are somehow your system is not finding the support for it correctly it may be because the w32api.h was removed which had the reference to where the WSAEVENT was located.