开发者

XCode: Two targets, two main files?

开发者 https://www.devze.com 2023-01-08 09:48 出处:网络
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.

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.

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.

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 Tou开发者_如何学JAVAch, I can make this one as a Shell application, to further make it quick & dirty.

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.

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?


You may actually be able to have two main.m files. Put them in different folders on the file system. Add one to one target, and another to the other target.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消