【问题标题】:Cant build program on Objective-C using GNUstep无法使用 GNUstep 在 Objective-C 上构建程序
【发布时间】:2011-04-03 13:51:16
【问题描述】:

我正在尝试在 Linux (Ubuntu) 上的 Objective-C 上构建 hello world。 main.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

我该如何解决?

【问题讨论】:

  • 也许你需要将你的 Makefile 重命名为 GNUmakefile,正如错误所说...

标签: objective-c linux gnustep gnu-make


【解决方案1】:

在 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;
}

GNUmake 文件:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-28
    • 1970-01-01
    • 2011-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多