How to compile an objective program c under windows with independent MingW

I know how to compile an object program c using the gnustep version of mingw.

But I don't like their shell, and I want to use the standard mingw gcc compiler.

I put this gcc bin directory in the environment path, of course, open a command prompt in the helloworld.m directory

#import <Foundation/Foundation.h> 
int main (int argc, const char * argv[])
{
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  NSLog (@"Hello World!");
  [pool drain];
  return 0;
}

and enter

gcc -o hello hello.m -I /GNUstep/System/Library/Headers -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base -fconstant-string-class=NSConstantString

but it does not work, because it cannot find the foundation / foundation .h

How to fix this and, if possible, avoid hardcoding in the welcome source code?

+2
source share
2 answers

Look here at the end of the post the blogger says to write:

gcc `gnustep-config --objc-flags` -o hello2 hello2.m -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base

It seems like you always need to go through GNUStep

+4
source

. , , .

gcc -I"c:/GNUstep/GNUstep/System/Library/Headers" -L "c:/GNUstep/GNUstep/System/Library/Libraries" -o hello hello.m -lobjc -lgnustep-base -fconstant-string-class=NSConstantString
+3

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


All Articles