问题
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++.
回答1:
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
回答2:
- You can call vala-generated code from C++, but it's plain C and quite pain to use from C++.
- Vala can only call C code, so you'd have to wrap all your C++ code in
extern "C"
one. - Using Gtk from C++ via Gtkmm is no harder than using it from Vala and Qt is not any harder either.
- 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.
- Vala is not that much like C# and has it's share of quriks.
In general I'd recommend using Qt instead.
回答3:
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 …
回答4:
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++.
来源:https://stackoverflow.com/questions/8817112/how-would-i-mix-up-c-with-vala