Play Objective-c with GNUstep in windows

    技术2022-05-20  55

    Use NS (NeXtStep) Object in source.m, like:

     

    NSString *hello = @"Hello World!";//a NS string object

     

    creat a file in the folder where source.m at,named "GNUmakefile" with code:

    include $(GNUSTEP_MAKEFILES)/common.make TOOL_NAME = appname appname_OBJC_FILES = source.m include $(GNUSTEP_MAKEFILES)/tool.make

    - in console -

    compile with command : make

    run the app with command: ./obj/appname

     

     


     

    source.m #include<stdio.h> #include<Foundation/Foundation.h> int main(void){ NSString *helloString = @"Hello World!"; printf("%s/n",[helloString cString]); return 0; }

    get info = > Hello World!

     


    最新回复(0)