0

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.

  • 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 Mar 13 '14 at 17:51
  • 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 Mar 13 '14 at 21:04
  • Try to use gnustep-make package to build. And it's a better idea to ask on GNUstep mailing list. – Fred Frith-MacDonald May 03 '14 at 05:53

1 Answers1

-4

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.

Dave
  • 166
  • 2
  • 8
  • He said he was using gnustep which is a port of the Apple frameworks for ObjC so that's not the problem. – Lance Mar 13 '14 at 15:54
  • It is actually kinda funny that you are bringing up the iOS/Apple stuff. The reason I am even looking at Objective-C is because the job I recently started has a bunch of older code written in Objective-C and it all runs in the Windows environment. I also wondered why they had used Objective-C and I was just told it was written a long time ago. It isn't required for my job to learn this but it would be useful. – TheGump Mar 13 '14 at 16:43
  • Simply because he is using a framework does not mean that it is working correctly there could be an issue with, the release he downloaded, the way he built it, his system setup or many other things so it is completely fair to look into that as a problem. Unfortunately it is all to often that we are left with old code. If you cant get it working another thing you can do is take a look at small-talk. Objective-C was built in a similar fashion so if you know C and Small-Talk you will understand objective-C. – Dave Mar 13 '14 at 17:42
  • Understanding Smalltalk and C won't automagically make you understand Objective-C. Memory management in the old code for example. – Fred Frith-MacDonald May 03 '14 at 06:00