objective-c - 无法使用 GNUstep 在 Objective-C 上构建程序

标签 objective-c linux gnustep gnu-make

我正在尝试在 Linux (Ubuntu) 的 Objective-C 上构建 hello world。 主程序

#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

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

我可以运行它。

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

关于objective-c - 无法使用 GNUstep 在 Objective-C 上构建程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5529967/

相关文章:

ios - xcode .pch,从一个文件中排除

iphone - 如何格式化字符串中的日期?

linux - 如何调整内核模块以通过 `no symbol version for module_layout` ?

linux - 作为输入发送到curl --data 和--data-encode 的文件需要写入的格式

iOS8 Modal ViewController 旋转问题

objective-c - Objective-c:如何存储大量数据(iOS RSS应用程序)

python - 从命令行调用 python 脚本而不先输入 "python"

objective-c - 从 Notepad++ 自动化 GNUStep

objective-c - 生成文件问题。 [Ubunt、GNUstep、ObjC、]

objective-c - 无法在动态链接库 libintl-8.dll 中找到过程入口点 __printf__