discuss-gnustep
[Top][All Lists]
Advanced

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

Hello World not getting off the ground


From: Jay Versluis
Subject: Hello World not getting off the ground
Date: Sat, 1 Jul 2017 13:45:26 -0400

Dear friends,

I’m a new GNUstep user with a decent amount of Objective-C experience through Xcode on the Mac. I thought I could put my knowledge to good use for developing cross platform applications, and thought GNUstep might be the answer. However, after a week of trying every available tip I could find on the web, I still can’t get a simple Hello World project to compile without errors. I present to you my case.

My code is as simple as this:

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
        NSLog(@"Hello, World!\n");
        NSLog(@"Made with Objective-C\n");
    }
    return 0;
}

I’m trying to compile this with gcc `gnustep-config —objc-flags` `gnustep-config —base-libs` -o hello *.m

The compiler throws an error related to @autorelease, something that Xcode likes adding when creating from a template. No trouble, I’ll take that statement out, so we’re left with this:

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
   
      NSLog(@"Hello, World!\n");
      NSLog(@"Made with Objective-C\n");
    
    return 0;
}

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. And it only happens at runtime. Another variation on the code was to make the main method a (void) method, but that didn’t make a difference.

Why is this happening? What am I doing wrong here?

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! On Windows I’ve also tried compiling with a GNUmakefile. The compilation works without a hitch, however I still get the above errors by the dozen. I did try clang on CentOS too, but not knowing the right flags didn’t get me anywhere. I wish everything was as easy as pressing that button in Xcode… but alas it is not. 

For the makefile I’ve loosely followed this guide: http://www.gnustep.org/resources/documentation/Developer/Base/ProgrammingManual/manual_1.html#Building-Your-First-Objective_002dC-Program I’ve even tried to compile the source code in the example, but the standard C library can’t be found on Windows. On that note, both Gorm and Project Center refuse to start and quit with a Runtime Error. Perhaps it’s a sign. Maybe I’m just not meant to use GNUstep.

But before giving up, I thought I’d ask you experienced folks for help. aeruder was very kind yesterday on IRC already, with his help at least something compiles on my systems.

Any tips to guides are welcome! I’d love to use GNUstep, even if GNUstep doesn’t want to be used :-) 

 

JAY VERSLUIS 



reply via email to

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