Discussion about Objective-C programming language
Hello guys,
I have installed gnustep on my PC (OS: Windows).
The GUI application is compiled successfully but when I executed the created application nothing is done (application is not shown and there is no any error).
Below are coming my GNUmakefile and source file (MyApp.m)
MyApp.m
GNUmakefile:
Execute application:
openapp MyFirstApp.app
Note:
I have download and install Gorm. It works correctly and shows GUI application.
Thanks in advance for any helps.
Hello guys,
I have installed gnustep on my PC (OS: Windows).
The GUI application is compiled successfully but when I executed the created application nothing is done (application is not shown and there is no any error).
Below are coming my GNUmakefile and source file (MyApp.m)
MyApp.m
Code:
#include <Foundation/Foundation.h>
#include <AppKit/AppKit.h>
@interface MyDelegate : NSObject
- (void) printHello: (id)sender;
- (void) applicationWillFinishLaunching: (NSNotification *)not;
@end
@implementation MyDelegate : NSObject
- (void) printHello: (id)sender
{
printf ("Hello!\n");
}
- (void) applicationWillFinishLaunching: (NSNotification *)not
{
NSMenu *menu;
NSMenu *infoMenu;
NSMenuItem *menuItem;
menu = AUTORELEASE ([NSMenu new]);
infoMenu = AUTORELEASE ([NSMenu new]);
[infoMenu addItemWithTitle: @"Info Panel..."
action: @selector (orderFrontStandardInfoPanel:)
keyEquivalent: @""];
[infoMenu addItemWithTitle: @"Help..."
action: @selector (orderFrontHelpPanel:)
keyEquivalent: @"?"];
menuItem = [menu addItemWithTitle: @"Info..."
action: NULL
keyEquivalent: @""];
[menu setSubmenu: infoMenu forItem: menuItem];
[menu addItemWithTitle: @"Print Hello"
action: @selector (printHello:)
keyEquivalent: @""];
[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);
}
GNUmakefile:
Code:
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.make
Execute application:
openapp MyFirstApp.app
Note:
I have download and install Gorm. It works correctly and shows GUI application.
Thanks in advance for any helps.
Last edited by a moderator: