#include <Foundation/Foundation.h> #include <AppKit/AppKit.h> @interface MyDelegate : NSObject - (void) applicationWillFinishLaunching: (NSNotification *)not; @end @implementation MyDelegate : NSObject - (void) applicationWillFinishLaunching: (NSNotification *)not { NSMenu *menu; menu = AUTORELEASE ([NSMenu new]); [menu addItemWithTitle: @"Quit" action: @selector (terminate:) keyEquivalent: @"q"]; [NSApp setMainMenu: menu]; } @end int main (int argc, const char **argv) { [NSApplication sharedApplication]; [NSApp setDelegate: [MyDelegate new]]; return NSApplicationMain (argc, argv); }Put this code for example into a file called MyApp.m, and use the following GNUmakefile for it:
include $(GNUSTEP_MAKEFILES)/common.make APP_NAME = MyFirstApp MyFirstApp_OBJC_FILES = MyApp.m # Uncomment the following if you have an icon #MyFirstApp_APPLICATION_ICON = MyApp.png #MyFirstApp_RESOURCE_FILES = MyApp.png include $(GNUSTEP_MAKEFILES)/application.makeCompile it, then run it using openapp ./MyFirstApplication.app (see the GNUmakefile mini-tutorial for further information on writing GNUmakefiles).