不能使用GNUstep在Objective-C上构建程序

Dec*_*eck 1 linux objective-c gnu-make gnustep

我正在尝试在Linux上的Objective-C(Ubuntu)上构建hello world.main.c中

#import <Foundation/Foundation.h>

int main(void)
{

    NSLog(@"asdasd");  
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我不认为这里有错误.然后我创建了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
Run Code Online (Sandbox Code Playgroud)

然后我运行"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
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

小智 5

在Ubuntu系统上安装GNUstep库和工具很简单,只需sudo apt-get install gnustep gnustep-devel就可以了(严格来说,就我所知,Apt是安装软件最简单的方法 - 只要很长时间因为它在存储库中).事实证明我已经命名了它GNUMakefile,而我应该命名它GNUmakefile.

source.m:

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

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
Run Code Online (Sandbox Code Playgroud)

我可以运行它.

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
Run Code Online (Sandbox Code Playgroud)