views:

40

answers:

1

Hello,

I'm learning Objective-C and using GNUStep, but when i try to execute my very simple Hello World application, just to test, it doesn't printed nothing. My code is like this:

// main.m
#include <stdio.h>

int main(void)
{
    printf("Hello, World\n");
}

Here is the GNUmakefile:

GNUSTEP_MAKEFILES = /GNUstep/System/Library/Makefiles
include $(GNUSTEP_MAKEFILES)/common.make

APP_NAME = HelloWorld
HelloWorld_HEADERS = 
HelloWorld_OBJC_FILES = main.m
HelloWorld_RESOURCE_FILES =

include $(GNUSTEP_MAKEFILES)/application.make

And when i execute this application i got this:

Nathan Campos@EEEPC-VMD0U56 ~/HelloWorld.app
$ ./HelloWorld

Nathan Campos@EEEPC-VMD0U56 ~/HelloWorld.app
$

What is wrong?

+1  A: 

I am an Obj-C newbie myself, but have you tried simply compiling directly without a make file? On my machine, with your source code, if I run the following:

gcc main.m -lobjc

I get a binary and when I execute the binary it prints out the message. If that does not work, you could try just building it as a C program and see if that works. I don't know if you would have to rename the file to main.c, but on my machine I just ran it as is:

gcc main.m

If that doesn't work then I suspect there is something wrong with the libraries. If this works, then I suspect the issue is with the makefile.

Dr. Watson
Valorize yourself, you're not a newbie, you're a beginner. ;)
Nathan Campos