简体   繁体   English

无法运行新的主文件Xcode

[英]Can't Run New Main File Xcode

I have just started learning C programming and using Xcode 4.6.2. 我刚刚开始学习C编程并使用Xcode 4.6.2。 When I create a new target for my Xcode project, everything works but Xcode only runs the original target's main class. 当我为我的Xcode项目创建一个新目标时,一切正常,但Xcode仅运行原始目标的主类。 How can I run my new target's main class? 如何运行新目标的主班?

If you have a second, separate source code file that contains your " main " function, you can set it's "target membership" by using the "file inspector" (which appears along the right side of the Xcode window). 如果您有另一个包含“ main ”功能的单独的源代码文件,则可以使用“文件检查器”(在Xcode窗口的右侧显示)将其设置为“目标成员身份”。

It looks like this: 看起来像这样:

您可以通过这种方式设置目标会员

The idea here is that you'll have one " main " function in one file for your first target, and a separate " main " function in another file for your second target. 这里的想法是,对于第一个目标,您将在一个文件中有一个“ main ”函数,对于第二个目标,您将在另一个文件中具有一个单独的“ main ”函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM