Search code examples
c++windowsfml

How can I create a window on OSX for use in C++?


How do I create a window without any dependencies? I wan't to know what goes behind the scenes when something like a window is made in SFML for example. How can I do this in C++; I was told C++ can't do that, then how does SFML do it?


Solution

  • The native GUI Framework for MacOsX is Cocoa, which you can't use with just c++, you can nevertheless mix C++ with objC or swift code (which are the "official" Apple dev languages) to access the Cocoa API. Otherwise, you have to rely on some third-party GUI library for C++ (or with C++ bindings). Depending on what you want to do you may want to consider Qt, OpenGL (with something like Glut or glfw), GTK+, etc. Qt is very popular these days, btw.