I am interested in developing for elementary OS, but what's holding me back from doing so is that I can't figure out how to use the Granite widgets from C++. I would prefer to use this instead of Vala.

1 Answer 1


Granite is written in Vala, so it provides a C API which you can use from C++. Using it should be fairly straightforward; just #include <granite.h> in your code, and build with something like

g++ -o test test.cpp `pkg-config --libs --cflags granite`

Then, you should be able to use Granite:

#include <granite.h>

void do_stuff (int w, int h) {
  GraniteDrawingBufferSurface* bs = granite_drawing_buffer_surface_new(w, h);

I chose Granite.Drawing.BufferSurface because it's the first class in the VAPI, but you can use any public API this way.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.