问题
I have created an 'External Build Project' in Xcode 4 using a makefile. 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 ?
回答1:
Yes, you need to create a Custom Executable, so that Xcode knows where your built executable resides and how to run it. In Xcode 3 it's 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 e.g. debug and release builds.
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:
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. In Xcode 4, choose Edit Active Scheme from the Scheme pop-up and choose the product you want to run (Figure 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.
回答2:
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)
来源:https://stackoverflow.com/questions/5879697/run-c-program-in-xcode-4-using-makefile