GNUstep compiling Objective C: Cannot find foundation/NSObject.h File -
i have started learning how program objective c. however, struggling test programs because cannot them compile. whenever try make makefile error in shell states "test1_1.h:5:33: fatal error: foundation/nsobject.h: no such file or directory compilation terminated. have files installed on computer i'm not sure how need tell compiler find these files. here program if helps. using windows system.
test1_0.m file
#include "test1_1.h" #include <appkit/appkit.h> int main(int argc, const char *argv[]) { nsautoreleasepool *pool; appcontroller *delegate; pool = [[nsautoreleasepool alloc] init]; delegate = [[appcontroller alloc] init]; [nsapplication sharedapplication]; [nsapp setdelegate: delegate]; release(pool); return nsapplicationmain (argc, argv); }
appcontroller.m file
#include "test1_1.h" #include <appkit/appkit.h> @implementation appcontroller - (void) applicationwillfinishlaunching: (nsnotification *) not { nsmenu *menu; nsmenu *info; menu = [nsmenu new]; [menu additemwithtitle: @"info" action: null keyequivalent: @""]; [menu additemwithtitle: @"select" action: null keyequivalent: @""]; [menu additemwithtitle: @"about" action: @selector(hide:) keyequivalent: @"h"]; [menu additemwithtitle: @"quit" action: @selector(terminate:) keyequivalent: @"q"]; info = [nsmenu new]; [info additemwithtitle: @"info panel" action: null keyequivalent: @""]; [info additemwithtitle: @"info panel" action: null keyequivalent: @""]; [info additemwithtitle: @"info panel" action: null keyequivalent: @""]; [menu setsubmeu: info foritem: [menu itemwithtitle: @"info"]]; release(info); [nsapp setmainmenu:menu]; release(menu); window = [[nswindow alloc] initwithcontentrect: nsmakerect: nsmakerect(300, 300, 200, 100) stylemask: (nstitledwindowmask | nsminiaturizablewindowmask | nsresizablewindowmask) backing: nsbackingstorebuffered defer: yes]; [window settitle: @"hello world"]; label = [[nstextfield alloc] initwithframe: nsmakerect(30, 30, 80, 30)]; [label setselectable: no]; [label setbezeled: no]; [label setdrawsbackground: no]; [label setstringvalue: @"hello world"]; [[window contentview] addsubview: label]; release(label); } - (void) applicationdidfinishlaunching: (nsnotification *) not { [window makekeyandorderfront: self]; } - (void) dealloc { release(window); [super dealloc]; } @end }
test1_1.h file
#ifndef _appcontroller_h_ #define _appcontroller_h_ #include "foundation/nsobject.h" @class nswindow; @class nstextfield; @class nsnotification; @interface appcontroller : nsobject { nswindow *window; nstextfield *label; } - (void)applicationwillfinishlaunching:(nsnotification *) not; - (void)applicationdidfinishlaunching:(nsnotification *) not; @end #endif /* _appcontroller_h_ */
makefile
helloworld: test1_0.m appcontroller.m gcc -o helloworld test1_0.m appcontroller.m -i c:/users/desktop/testing
Comments
Post a Comment