lördag 13 november 2010

Hello Objective-C

No solution to the evil Gorm association in ProjectCenter so far. However, I use WindowMaker and Gvim and do some GNUstep/Objective-C coding anyway.

Just to make sure that everything is working, here's some nice GNUstep code to display a panelalert.

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

int 
main (void)
{
  NSAutoreleasePool *pool;
  
  pool = [NSAutoreleasePool new];
  
  [NSApplication sharedApplication];
  
  NSRunAlertPanel (@"Test", @"Hello from the GNUstep AppKit", 
                   nil, nil, nil);

  return 0;
}
To build this one in the terminal, you better write a GNUmakefile. That's actually the name you have to give it. (you can read all about it here )
the content for now should be

include $(GNUSTEP_MAKEFILES)/common.make
APP_NAME = FirstApp
FirstApp_OBJC_FILES = source.m
include $(GNUSTEP_MAKEFILES)/application.make
Simply type "make" and there's your .app. Run it with "openapp ./FirstApp.app".
If "make" gives you a headache, make sure you have the GNUstep-dev package installed if you went the app-get path, and check your variables with "env | grep GNU". (ignore the old GNU_ROOT.. variables though)

Inga kommentarer:

Skicka en kommentar