[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Hello World not getting off the ground
From: |
David Chisnall |
Subject: |
Re: Hello World not getting off the ground |
Date: |
Sat, 1 Jul 2017 19:22:27 +0100 |
On 1 Jul 2017, at 18:45, Jay Versluis <versluis2000@yahoo.com> wrote:
> I’m trying to compile this with gcc `gnustep-config —objc-flags`
> `gnustep-config —base-libs` -o hello *.m
If you wish to use gcc for Objective-C, then be aware that you are restricted
to not being able to use ARC or any of the newer syntactic sugar related to
NSValue, NSArray and NSDictionary literals. This includes @autoreleasepool and
so you will need to explicitly create NSAutoreleasePool objects.
> Compiling with the same statements yields no errors. I’d say “hurra”, however
> when I run the app, I get what feels like several hundred lines or errors,
> all beginning with “autorelease pool called for object”, followed by a
> variety of NSObjects such as NSUserDefaults, NSDateMalloc, NSCalendarDate as
> well as stuff like GSDictionary, GSInlineString, GSAbsoluteTime - in short,
> nothing that I’ve called here.
Right, this is what you’d expect because you don’t have an autorelease pool in
place and NSLog generates a number of autoreleased objects in response to
various +initialize methods.
> What’s perhaps interesting is that I’m getting the exact same problem under
> CentOS 7, Ubuntu 16, as well as Windows 10. Yes indeed, I’ve tried them all!
Unsurprising, this is exactly what you should expect. If you wish to use a
modern dialect of Objective-C, then you will need to use clang, not gcc.
David