简体   繁体   English

使用C ++在Mac OS X上创建应用程序? (没有Cocoa)

[英]Creating an application on Mac OS X using C++? (without Cocoa)

It seems that in Xcode 4 there is no longer a way to create an application that is not limited to the command line using C or C++. 似乎在Xcode 4中,不再有办法创建一个不限于使用C或C ++的命令行的应用程序。 I would like to do so, however Glut seems to be one of the only frameworks available for mac that works with C++ and OpenGL, however gluts features are beginning to stop working on modern Operating Systems. 我想这样做,但Glut似乎是可用于与C ++和OpenGL一起工作的mac的唯一框架之一,但是gluts功能开始停止在现代操作系统上工作。 Are there other alternatives that will allow me to use C++ or C for software development on a mac? 还有其他替代方案可以让我在Mac上使用C ++或C进行软件开发吗? It does not have to be limited to using xcode or opengl. 它不必限于使用xcode或opengl。

Yes, it's possible, but it may not be a very good idea. 是的,这是可能的,但这可能不是一个好主意。 The real question is what problem are you trying to solve? 真正的问题是你想解决什么问题?

If you just don't like Obj-C, it should be straightforward to write a very thin shim that wraps the calls you care about in C++. 如果你不喜欢Obj-C,那么编写一个非常薄的垫片应该很简单,它可以包含你在C ++中关注的调用。

If you are trying to prove a point, you can actually make calls directly into the Obj-C runtime in plain C code. 如果您试图证明一个观点,您实际上可以在普通C代码中直接调用Obj-C运行时。 See this for example: using objc_msgSend to call a Objective C function with named arguments 例如,请参阅: 使用objc_msgSend调用带有命名参数的Objective C函数

If it's something else, please enlighten us so we can better answer your question. 如果它是别的,请启发我们,以便我们更好地回答您的问题。

QT is your best bet. QT是你最好的选择。 It comes with a serious IDE and the libraries are written in a very good & intuitive C++. 它带有一个严肃的IDE,库是用非常好的和直观的C ++编写的。

QT can be found here: http://qt-project.org/downloads QT可以在这里找到: http//qt-project.org/downloads

If all you want is a window, an OpenGL context, and user interfacing, then go the SDL way. 如果你想要的只是一个窗口,一个OpenGL上下文和用户接口,那么就去SDL方式。 Completely written in C, cross platform, and almost object-oriented (most data types are structs, anyways). 完全用C语言编写,跨平台,几乎面向对象(大多数数据类型都是结构,反正)。 It's also very memory economic (its core DLL is less than 500KB in size and a windowless program uses less than 1MB of RAM on Linux), unlike the monster that is Qt. 它也非常经济(它的核心DLL大小不到500KB,而无窗口程序在Linux上使用不到1MB的RAM),不像Qt的怪物。

I'd also recommend LazyFoo's tutorials to get started, since they indeed cover the learning from the perspective of a C++ programmer, not a C one. 我还推荐LazyFoo的教程开始,因为它们确实涵盖了从C ++程序员而不是C语言程序员的角度来学习。

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

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