开发者

Cant build program on Objective-C using GNUstep

I'm trying to build hello world on Objective-C on Linux (Ubuntu). main.c

#import <Foundation/Foundation.h>

int main(void)
{

    NSLog(@"asdasd");  
    return 0;
}

I don't th开发者_运维技巧ink there is the error here. Then i'd created Makefile:

GNUSTEP_MAKEFILES = /usr/share/GNUstep/Makefiles

include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = main
main_OBJC_FILES = main.m
include $(GNUSTEP_MAKEFILES)/tool.make

And then i run "make":

This is gnustep-make 2.2.0. Type 'make print-gnustep-make-help' for help.
Making all for tool main...
make[1]: GNUmakefile: no such file or directory

How can i fix it ?


Installing the GNUstep libraries and tools on an Ubuntu system is simple, just sudo apt-get install gnustep gnustep-devel and you're all set (seriously, Apt is, as far as I know, the easiest way to install software - as long as it's in the repositories). Turns out I had named it GNUMakefile, while I should have named it GNUmakefile.

source.m:

#import <Foundation/Foundation.h>
int main(void)
{
    NSLog(@"asdasd");  
    return 0;
}

GNUmakefile:

GNUSTEP_MAKEFILES = /usr/share/GNUstep/Makefiles

include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = app
app_OBJC_FILES = source.m
include $(GNUSTEP_MAKEFILES)/tool.make

And I can run it.

us@com:~/ObjectiveC$ make
This is gnustep-make 2.6.0. Type 'make print-gnustep-make-help' for help.
Making all for tool app...
 Compiling file source.m ...
 Linking tool app ...

us@com:~/ObjectiveC$ ./obj/app
2011-11-22 18:01:21.285 app[8042] asdasd
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜