Xcode:创建可执行文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35015902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode: creating an executable file
提问by Nabin Bhusal
I am using Xcode to do C++ programming but the problem is when i build the program it doesnot creat a executable file like Turbo C++ creates a .exe file. What can i do to create such executable file on OS X environment using xcode.?
我正在使用 Xcode 进行 C++ 编程,但问题是当我构建程序时,它不会创建像 Turbo C++ 创建的 .exe 文件那样的可执行文件。我该怎么做才能使用 xcode 在 OS X 环境中创建这样的可执行文件?
回答by goodstar
Follows this: File->Project Settings->under Derived Data, Click the Advanced->Click Custom, then choose the option Relative to Workspace->Done. Then build your code and you will see Product file package in your project path. I am using Xcode 8.2.1, hope it may help.
如下:File->Project Settings->Derived Data下,点击Advanced->点击Custom,然后选择Relative to Workspace->Done选项。然后构建您的代码,您将在项目路径中看到产品文件包。我正在使用 Xcode 8.2.1,希望它可以帮助。
回答by SaschaM78
I'll try to summarise the following article and hope it'll help you get started:
我将尝试总结以下文章,希望它能帮助您入门:
How To: Compile and Run Basic C++ Programs in Xcode
- Start a new project: select File, New Project
- in the Applicationdropdown, pick your desired application type (i.e. "command line utility") and choose "C++ Tool"
- choose a location (and remember the path for later) and click Finish
- Start coding your application
- when you are done, click on the Buildbutton
- now Finder and navigate to the project folder that you picked in step 3
- in it, you should find a file with the name of your project without any extension
- double click the file et voilà, your application should starts (in the example above, a terminal window should appear)
- 开始一个新项目:选择File,New Project
- 在应用程序下拉列表中,选择所需的应用程序类型(即“命令行实用程序”)并选择“C++ 工具”
- 选择一个位置(并记住路径以备后用)并单击完成
- 开始编写您的应用程序
- 完成后,单击“构建”按钮
- 现在 Finder 并导航到您在步骤 3 中选择的项目文件夹
- 在里面,你应该找到一个文件名,没有任何扩展名
- 双击文件 et voilà,你的应用程序应该启动(在上面的例子中,一个终端窗口应该出现)
Let me know if it helped you solve your problem.
如果它帮助您解决问题,请告诉我。
回答by Phani Srikar
I got a simple solution for you got Product > archive and select distribute content and use the build option. Dig deep into the folder created and you can find the Mac executable file that'll run almost on any Mac.
我为您提供了一个简单的解决方案,让您获得 Product > archive 并选择分发内容并使用构建选项。深入研究创建的文件夹,您可以找到几乎可以在任何 Mac 上运行的 Mac 可执行文件。