2

I need to write GUI applications for cross platform in C++ but since most of GUI libraries for C++ are bit tedious and I am quite familiar with C#/.NET I found out code Vala codes with GTK is quite interesting and bit easy compare with other ways.so how would I mix up VAlA with C++. I meant use VALA for front end and code rest of parts in C++.

user1120193
  • 252
  • 3
  • 11
  • possible duplicate of [Vala GUI and logic in C++](http://stackoverflow.com/questions/16885242/vala-gui-and-logic-in-c) – user Apr 07 '14 at 11:12

4 Answers4

11
  1. You can call vala-generated code from C++, but it's plain C and quite pain to use from C++.
  2. Vala can only call C code, so you'd have to wrap all your C++ code in extern "C" one.
  3. Using Gtk from C++ via Gtkmm is no harder than using it from Vala and Qt is not any harder either.
  4. Qt is the only really cross-platform option. Gtk now works natively on MacOS X, but is still not as stable. And Qt also works on most smart-phone platforms, Gtk does not.
  5. Vala is not that much like C# and has it's share of quriks.

In general I'd recommend using Qt instead.

Jan Hudec
  • 73,652
  • 13
  • 125
  • 172
  • 1
    what about wxwidget? what would u think about it? – user1120193 Jan 11 '12 at 16:12
  • @Gryphes: I never used it, but from what I saw, wxWidget design is inspired by MFC design, which is horrible and obsolete. It's not hard to use, but lacks flexibility. – Jan Hudec Jan 12 '12 at 10:40
  • 2
    @Gryphes: Besides, wxWidget does not work on smart phone platforms either. Qt has ports for Android, iPhone, Windows CE and Symbian. – Jan Hudec Jan 12 '12 at 10:54
  • @jan-hudec nowadays there is a mature enough wxQt port to port wxWidgets to these devices using Qt. –  Aug 11 '15 at 16:54
  • This by far the better answer. Actually answers the question THEN suggests an alternative – Zander Brown Apr 11 '17 at 13:06
1

Vala compiles to C making heavy use of the GObject type system. You can use this using glibmm which is part of gtkmm from C++. But you might just as well just use gtkmm (i.e. with GtkBuilder) then …

filmor
  • 30,840
  • 6
  • 50
  • 48
0

It may not answer your question fully, but if you use mono to embed C# into c++, you can use GTK# directly from windows (and it will compile and run in mac and linux too).

Then, you will be able to use C#/GTK# for the front end and code rest of parts in c++.

holgac
  • 1,509
  • 1
  • 13
  • 25
  • 1
    thanks but I am not looking for an alternative solution. I really need to make this work or at least avoid Microsoft technologies for opensource/free apps. :P – user1120193 Jan 11 '12 at 09:59
-4

You can use QT if it's meeting your requirements. Qt is a cross-platform application and UI framework with APIs for C++ programming as well. http://developer.qt.nokia.com/doc/qt-4.8/gettingstartedqt.html

Izza
  • 2,389
  • 8
  • 38
  • 60