[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lack of documentation on how to compile hello world on windows

From: David Chisnall
Subject: Re: Lack of documentation on how to compile hello world on windows
Date: Sun, 12 Sep 2010 16:49:15 +0100

On 12 Sep 2010, at 11:36, gnustepnewbie wrote:

> I have wandered all around the web to just compile my hello world none of the
> examples given worked for the latest version I downloaded.

You've walked all over the web, found that every example tells you to use 
GNUstep Make or, if you must, gnustep-config, and decided that you don't want 
to because it's too complicated, then found that there is a reason that they're 
telling you to.

> So how to really do such a simple stuff as this doesn't work:
> gcc -o hello hello.m -I /GNUstep/System/Library/Headers -L
> /GNUstep/System/Library/Libraries -lobjc -lgnustep-base
> -fconstant-string-class=NSConstantString

This looks like it might work, for some platforms.  If you really insist on not 
using GNUstep Make, you should instead do this:

$ gcc `gnustep-config --objc-flags --base-libs` -o hello hello.m

> source of hello.m I put under GNUstep directory

Why?  gcc expects to find it in the current directory.

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

This looks sensible, although I'd omit the -drain message at the end - it just 
delays program shutdown (no point reclaiming memory immediately before exit, 
the OS will do that when the process is destroyed).

> error returns: hello no such file or directory.

Error from what?  From the gcc command?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]