问题描述
我正在Xcode 4.3.3中构建C ++ OpenGL纸牌游戏,目的是在64位和32位Mac上运行它,这不是我的问题.我的问题是,在该程序的开发过程中,我想测试它是否可以在其他32位Mac(我的操作系统是64位)上运行而不必安装Xcode.显然,这需要我将其导出为.app.经过一些CD之后,我可以通过终端从我的项目中找到并运行导出的Unix可执行文件,但这对我和程序的目标读者来说是不可取的.我已经在Google和Stack Overflow上拖了网,寻找任何对我有帮助的东西,但是提到存档的所有事情似乎都没有成功完成我的特定项目,我认为这是因为这是一个C ++命令行工具项目.因此,有人可以帮我将项目导出为.app吗?预先感谢.
I am building a C++ OpenGL card game in Xcode 4.3.3, with the intention of running it on both 64-bit and 32-bit Macs, which is not my problem. My problem is that I have reached a point in the development of the program where I would like to test that it works on a different 32-bit Mac (mine is 64-bit) without having to install Xcode. This, obviously, requires me exporting it as an .app. I can find and run the exported Unix Executable File from my project, after some cd'ing, through Terminal, but that is undesirable for me and the intended audience of the program. I have trawled the google and Stack Overflow, looking for anything to help me, but all the things mentioning Archiving seem to have been unsuccessful with my particular project, and I think that's because it's a C++ command line tool project. So, can someone please help me export my project as a .app?Thanks in advance.
推荐答案
最简单的方法是创建一个Cocoa项目,进入构建阶段",并从链接与库的构建阶段,删除模板添加的所有Objective-C文件(应用程序委托等),然后将main.c替换为main.cpp文件.
The simplest way of doing this would be to create a Cocoa project, go to 'build phases' and remove all the objective-c frameworks from the 'link with libraries' build phase, remove any objective-c files added by the template (app delegate, etc.) and then replace main.c with your main.cpp file.
除了它与Cocoa链接并从其main()函数调用NSApplicationMain()之外,Cocoa项目并没有什么特别之处.
There's nothing really special about a Cocoa project except for the fact that it links against Cocoa and calls NSApplicationMain() from its main() function.
可可也使用了许多.plist条目,您将不再需要它们.但是它们不会影响OS X处理您的应用程序的方式.
There are also a bunch of .plist entries used by Cocoa which you'll no longer need. But they won't affect the way OS X treats your application.
这篇关于为非Cocoa C ++ Mac项目构建应用程序捆绑包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!