3

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++. 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. Are there other alternatives that will allow me to use C++ or C for software development on a mac? It does not have to be limited to using xcode or opengl.

5
  • There are some cross-platform GUI toolkits like Qt and GTK that have Quartz or Cocoa backends, but they invariably result in some degree of non-native look-and-feel. You can write Cocoa apps using mostly C++ and only a tiny bit of Objective-C. Commented Jan 2, 2013 at 23:16
  • How? Are there good places to learn how to do this? Commented Jan 2, 2013 at 23:19
  • SDL works on OSX, doesn't it? Most people use it for games, but there's nothing stopping you from using it for serious work. Commented Jan 2, 2013 at 23:53
  • @BenVoigt yes, as does SFML Commented Jan 2, 2013 at 23:54
  • I use GLFW + GLEW. Simple and easy. Commented Jan 3, 2013 at 15:12

3 Answers 3

6

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++.

If you are trying to prove a point, you can actually make calls directly into the Obj-C runtime in plain C code. See this for example: using objc_msgSend to call a Objective C function with named arguments

If it's something else, please enlighten us so we can better answer your question.

Sign up to request clarification or add additional context in comments.

Comments

4

QT is your best bet. It comes with a serious IDE and the libraries are written in a very good & intuitive C++.

QT can be found here: http://qt-project.org/downloads

1 Comment

For a purist point of view, Qt is not C++. From a practical point of view, Qt is not good C++.
1

If all you want is a window, an OpenGL context, and user interfacing, then go the SDL way. Completely written in C, cross platform, and almost object-oriented (most data types are structs, anyways). 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.

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.