使用 Makefile 编译 Objc 项目

发布于 2024-10-25 10:15:26 字数 795 浏览 1 评论 0原文

我正在尝试制作跨平台游戏并创建项目(http://cl.ly/5QRn)。我试图做到这一点,但得到:

Mark-Fedurins-iMac:Evolve hitecnologys$ make
gcc -g   -c -o OSX/AppDelegate.o OSX/AppDelegate.m
gcc -g   -c -o OSX/osx.o OSX/osx.m
gcc -g   -c -o main.o main.m
In file included from OSX/osx.m:2,
                 from main.m:6:
OSX/AppDelegate.m: In function ‘main’:
OSX/AppDelegate.m:4: error: expected expression before ‘interface’
In file included from main.m:6:
OSX/osx.m:10: error: expected expression before ‘end’
main.m:8: error: ‘app’ undeclared (first use in this function)
main.m:8: error: (Each undeclared identifier is reported only once
main.m:8: error: for each function it appears in.)
make: *** [main.o] Error 1

我做错了什么?请回答这个愚蠢的白痴他应该做什么:) 谢谢!

I'm trying to make crossplatform game and created project(http://cl.ly/5QRn). I'm trying make it but get:

Mark-Fedurins-iMac:Evolve hitecnologys$ make
gcc -g   -c -o OSX/AppDelegate.o OSX/AppDelegate.m
gcc -g   -c -o OSX/osx.o OSX/osx.m
gcc -g   -c -o main.o main.m
In file included from OSX/osx.m:2,
                 from main.m:6:
OSX/AppDelegate.m: In function ‘main’:
OSX/AppDelegate.m:4: error: expected expression before ‘interface’
In file included from main.m:6:
OSX/osx.m:10: error: expected expression before ‘end’
main.m:8: error: ‘app’ undeclared (first use in this function)
main.m:8: error: (Each undeclared identifier is reported only once
main.m:8: error: for each function it appears in.)
make: *** [main.o] Error 1

What I do wrong? Please answer the stupid idiot what he should do :)
Thx!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

开始看清了 2024-11-01 10:15:26

首先 - 为什么要 #import'ing .m 文件? #import 用于头文件 (.h)。其次,这只是一个语法错误,与您使用 makefile 的事实无关,因此您的主题行选择错误。它的拼写是“@interface”,而不是“interface”。同样,在 main.m 中,您使用了一个尚未声明的名为“app”的变量。

一般来说,听起来你需要阅读语言教程 - 你不能只是编造一些东西并期望编译器理解它。

http://developer.apple.com/library/ mac/#referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/_index.html

First of all - why are you #import'ing .m files? #import is for header (.h) files. Second, this is just a syntax error, nothing to do with the fact you're using a makefile, so your subject line is badly chosen. It's spelled "@interface", not "interface". Likewise, in main.m, you're using a variable named "app" which you haven't declared.

In general, it sounds like you need to read a language tutorial - you can't just make stuff up and expect the compiler to understand it.

http://developer.apple.com/library/mac/#referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/_index.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文