我试图在linux(ubuntu)上的objective-c上构建hello world。
主C

#import <Foundation/Foundation.h>

int main(void)
{

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

我认为这里没有错误。然后我创建了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

然后我运行“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

我怎样才能修好它?

最佳答案

在ubuntu系统上安装gnustep库和工具很简单,只要sudo apt get install gnustep gnustep devel就可以了(说真的,据我所知,apt是安装软件最简单的方法,只要它在存储库中就行)。
结果我把它命名为GNUMakefile,而我应该把它命名为GNUmakefile
来源m:

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

gnumakefile(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

而且我可以运行它。
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

08-26 09:03