How would I mix up C++ with VALA

时光毁灭记忆、已成空白 提交于 2019-12-12 19:19:33

问题


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:


  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.




回答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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!