XCode:两个目标,两个主要文件? [英] XCode: Two targets, two main files?

查看:192
本文介绍了XCode:两个目标,两个主要文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在XCode中开发一个游戏,我想添加一个帮助应用程序,使用主应用程序的各种类来构建主应用程序的数据文件。

I'm working up a game in XCode, and I want to add a helper application that uses the main application's various classes to build the main application's data files.

具体来说:
主要应用是纸牌游戏。
我想要一个帮助应用程序,它使用类card.m,它创建了deck.xml文件的游戏使用的自定义卡片。

Specifically: The main application is a card game. I want a helper app that uses the classes such as card.m while it creates the deck.xml files for the deck of custom cards the game uses.

我的直觉是,这样做的自然方式是添加第二个编译目标到应用程序Card Adder,以构建此xml文件。不像主要的应用程序,这是Cocoa Touch,我可以使这个作为一个Shell应用程序,进一步使它快速&肮脏。

My intuition is that the natural way to do this is to add a second compile target to the application, "Card Adder", to build this xml file. Unlike the main app, which is Cocoa Touch, I can make this one as a Shell application, to further make it quick & dirty.

这里是我的挂断,我的问题:
什么开始作为第二个目标的主要例程?看看我现有的main.m文件,我看到它只与主要的游戏应用程序相关联。到现在为止还挺好。但是,我当然不能为helper / shell应用程序添加第二个main.m文件。

Here's my hang up, and my question: What kicks off as the main routine for this second target? Looking over my existing main.m file, I see it's only associated with the main game app. So far so good. But of course I can't add a second main.m file for the helper/shell app.

我如何解决这个问题?我用什么代替main.m?如何向编译目标Card Adder发信号通知这个新文件将包含它的主子程序?

How do I get around this? What do I use in place of a main.m? How do I signal to the compile target "Card Adder" that this new file will contain it's main subroutine?

推荐答案

文件的名称,但函数的名称/签名

It's not the name of the file, but the name/signature of the function

  int main(int argc, char *argv[])

这很重要。只需在其中创建一个带有此函数的文件。每个应用程序只能有一个主。

That matters. Just make a file with this function in it. You can have only one main per application.

这篇关于XCode:两个目标,两个主要文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆