简体   繁体   English

使用 makefile 在 Xcode 4 中运行 C 程序

[英]Run C program in Xcode 4 using makefile

I have created an 'External Build Project' in Xcode 4 using a makefile.我使用 makefile 在 Xcode 4 中创建了一个“外部构建项目”。 The project builds perfectly, except the only way I know how to get it to run is in Terminal.该项目构建完美,除了我知道如何让它运行的唯一方法是在终端中。

Is there a way I can run the program in Xcode 4 or is Terminal it?有没有办法可以在 Xcode 4 中运行程序,或者是终端吗?

Yes, you can, Product -> Edit scheme Select "Run" from the left panel, select "Info" from top and specify "Executable" drop list Select next pane "Arguments" and add "Arguments Passed On Launch" (to "Executable" you select before) Yes, you can, Product -> Edit scheme Select "Run" from the left panel, select "Info" from top and specify "Executable" drop list Select next pane "Arguments" and add "Arguments Passed On Launch" (to "Executable "你之前的select)

Yes, you need to create a Custom Executable, so that Xcode knows where your built executable resides and how to run it.是的,您需要创建一个自定义可执行文件,以便 Xcode 知道您构建的可执行文件所在的位置以及如何运行它。 In Xcode 3 it's Project -> New Custom Executable... .在 Xcode 3 中,它是Project -> New Custom Executable...

This will allow you to to run your executable and even do source level debugging if you have added the source code to the project.如果您已将源代码添加到项目中,这将允许您运行可执行文件甚至进行源代码级调试。 The only minor hassle is that you have to manually select which custom executable is "active" when you switch between eg debug and release builds.唯一的小麻烦是,当您在调试和发布版本之间切换时,您必须手动 select 哪个自定义可执行文件是“活动的”。


Note re Xcode 4: I don't use Xcode 4 but looking at the online help the nearest equivalent to Xcode 3's "custom executable" seems to be:注意重新 Xcode 4:我不使用 Xcode 4 但查看最接近 Xcode 3 的“自定义可执行文件”的在线帮助

Customize Executables in the Scheme Editor在方案编辑器中自定义可执行文件
To customize the environment in which a product is launched in Xcode 3, you click the executable in the Groups & Files list and then open the Info window.要自定义在 Xcode 3 中启动产品的环境,请单击 Groups & Files 列表中的可执行文件,然后打开 Info window。 In Xcode 4, choose Edit Active Scheme from the Scheme pop-up and choose the product you want to run (Figure 3-10).在 Xcode 4 中,从 Scheme 弹出窗口中选择 Edit Active Scheme,然后选择要运行的产品(图 3-10)。 Note that you can choose to display the running product at a higher UI resolution to simulate running at a different display resolution.请注意,您可以选择以更高的 UI 分辨率显示正在运行的产品,以模拟以不同的显示分辨率运行。

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

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