3

I wondered why I couldn't find a question about that already. How can I create a cross-platform window in C++? By cross-platform I mean support for at least Windows, Mac and Linux.

If there is a library for only this task out there I am willing to use that. But I don't want to use a bloated library with window controls like wxWidgets.

I don't need GUI controls because I am going to use OpenGL. (And for some reason I don't want to use frameworks like GLUT or GLFW.)

danijar
  • 32,406
  • 45
  • 166
  • 297
  • how do you define *bloated*? – billz Nov 07 '12 at 05:24
  • 1
    Are you really sure you didn't get [this answer](http://stackoverflow.com/q/138831/1044750) automatically ? – vvnraman Nov 07 '12 at 05:24
  • I do not need GUI elements but just a window. So in this case a not bloated library would only perform the task of creating and managing (resize, minimize, toggle fullscreen) the window. – danijar Nov 07 '12 at 05:37

2 Answers2

3

There are others, I recommend and use FLTK. But Qt is also my favorite. See what works best for you and your patterns of thinking.

FLTK is extremely light weight.

Aniket Inge
  • 25,375
  • 5
  • 50
  • 78
  • I would like to just create a window. Both libraries you mentioned also provide GUI elements. So maybe this is a simpler task can easily be done without a framework, but I am not sure. – danijar Nov 07 '12 at 05:41
  • no, I really suggest you stick to 1 cross platform framework. Instantiation of a window in Win32 is fairly different from GTK and that much more different than instantiating on Mac OS X(cocoa). – Aniket Inge Nov 07 '12 at 05:43
  • 1
    Using a cross platform library allows you to abstract away from the native toolkit library(and the fuss in creating them for each platform). You can render OpenGL graphics on a FLTK window(there are _examples_ for that on their website) – Aniket Inge Nov 07 '12 at 05:44
  • Maybe I will use only the related code from open source cross platform libraries. – danijar Nov 07 '12 at 05:46
3

Try C++ bindings library for Tk. It's a very lightweight and simple.

Eugene Mamin
  • 749
  • 4
  • 8