Unable to compile C object using Gnustep in windows

Hi, I am starting to study target c. I find the error "hello.m: 1: 34: Foundation / Foundation.h: There is no such file or directory" I found out that I need to make a make file, can I know how to make a make file, please

+2
source share
4 answers

No need to create a make file. If you run MinGW from "All Programs → GNUstep → Shell" as described above, you can simply compile your .m file.

My GNUstep installation is located in the c: \ GNUstep \ GNUstep \ System directory. If you have something else, you should modify the Foundation.h import accordingly.

I have done this:

  • Create c: \ myprogs \ obj-c \ hello \ hello.m, which looks like this:

// ---------- Hello.m

#import <../../GNUstep/System/Library/Headers/Foundation/Foundation.h>

int main(int argc, const char* argv[])
{
    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
    NSLog(@"Hello from Hello.m!");

    [pool release];
    return 0;
}

//----------

  1. MinGW. (. .)

  2. , . ( , , Unix, Windows.):

    cd/c/myprogs/obj-c/hello

  3. :

    gcc -o hello hello.m -I/c/GNUstep/GNUstep/System/Library/Headers\

    -L/c/GNUstep/GNUstep/System/Library/Libraries -lobjc -lgnustep-base\

    -fconstant-- = NSConstantString

( , "\" .)

:

Info: resolving ___objc_class_name_NSAutoreleasePool by linking to __imp____objc_class_name_NSAutoreleasePool (auto-import)
Info: resolving ___objc_class_name_NSConstantString by linking to __imp____objc_class_name_NSConstantString (auto-import)

hello.exe :

2009-06-03 14:44:59.483 hello[1240] Hello from Hello.m!
+5

: gcc , include (.. , Foundation/Foundation.h).

gcc MinGW . "All Programs -> GNUstep -> Shell" " ", .

make , :

include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = YourProg
YourProg_OBJC_FILES = source_code.m
include $(GNUSTEP_MAKEFILES)/tool.make
+3

GNUStep, Foundation.

+1

make , , paxdiablo, , , , , make , make . , Windows , GNUStep Windows, , , make - GNUSTEP_MAKEFILES /GNUstep/System/Library/Makefiles , , - make , . ( make , , make , , , , .)

0
source

Source: https://habr.com/ru/post/1787271/


All Articles