Xcode:多个项目,多个主要可执行文件 [英] Xcode: multiple projects, more than one main executable

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

问题描述

我是 Xcode 的新手.我正在尝试学习 C++,我想知道是否可以有多个项目并选择应该运行哪个项目.我之前使用过 ms Visual Studios,我喜欢在一个解决方案下我可以创建多个项目并选择哪个是可执行的.Xcode 也有不完全确定它们是什么的目标,也许它们发挥了作用?我试图搞砸,但由于重复的电源,我经常遇到问题.我正在阅读一章并且有案例研究.我正在努力使一个项目中的每一章都井井有条.任何帮助谢谢!

Hi I'm new to Xcode. I'm trying to learn c++ and I was wondering if it is possible to have multi projects and choose which project should run. I used ms visual studios before and I like how under a solution I can create multiple projects and choose which one is the executable one. Xcode also has targets not exactly sure what they are maybe they play a role? I tried messing around but I constantly have issue because of duplicate mains. I'm going through a chapter and there are case studies. I'm trying to keep every chapter organized in one project well something like that. Any help thanks!

推荐答案

Xcode 目标可能就是您正在寻找的.您可以在一个项目中拥有多个目标,当您告诉 Xcode 编译或运行时,将使用您选择为活动的任何一个.如果您遇到重复电源的问题,您可能在所有目标中都有所有 .cpp 文件.如果您在同一个目标中有 main1.cpp 和 main2.cpp,Xcode 将尝试同时使用它们并遇到冲突.包括所有目标中的所有公共文件,但只有适当的主文件可能会解决您的问题.

Xcode targets are probably what you are looking for. You can have many targets in a single project, and whichever one you select as active will be used when you tell Xcode to compile or run. If you are having problems with duplicate mains, you probably have all of your .cpp files in all of your targets. If you have main1.cpp and main2.cpp in the same target, Xcode will attempt to use both of them and run into a conflict. Including all common files in all targets, but only the appropriate main files will likely solve your problems.

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

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