Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you create a window in Linux with C++?

Tags:

c++

linux

window

I was expecting a Linux API similar to the Windows API. All I see on Google is references to Qt and GTK. I really don't need anything more than a simple window to draw on with OpenGL, so these libraries appear bloated for my use. What do Qt and GTK use to create windows under Linux? Is there nothing more low-level?

like image 593
SteveDeFacto Avatar asked Jun 25 '12 14:06

SteveDeFacto


1 Answers

The X window system generally does the drawing - you then use a toolkit such as Qt or GTK on top of raw Xlib to provide event loops, drag and drop, starting apps on mouseclicks and all the other 'desktop' stuff

It's fairly easy to work directly with Xlib and opengl or if you just want to learn opengl the glut provides the framework you need to display a window, handle mouse/keyboard events and so on.

like image 170
Martin Beckett Avatar answered Sep 23 '22 00:09

Martin Beckett