我该如何混淆 C++与瓦拉

发布于 2024-12-26 01:23:41 字数 171 浏览 2 评论 0原文

我需要用 C++ 编写跨平台的 GUI 应用程序,但由于 C++ 的大多数 GUI 库都有点乏味,而且我对 C#/.NET 非常熟悉,我发现使用 GTK 的代码 Vala 代码非常有趣,并且与其他方式相比有点容易.那么我该如何将 VAlA 与 C++ 混合起来呢?我的意思是使用 VALA 作为前端,并用 C++ 编写其余部分。

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++.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不疑不惑不回忆 2025-01-02 01:23:41
  1. 您可以从 C++ 调用 vala 生成的代码,但它是普通的 C,并且从 C++ 使用起来相当痛苦。
  2. Vala 只能调用 C 代码,因此您必须将所有 C++ 代码包装在 extern "C" 中。
  3. 通过 Gtkmm 从 C++ 使用 Gtk 并不比从 Vala 使用 Gtk 难,而且 Qt 也不难。
  4. Qt 是唯一真正跨平台的选择。 Gtk 现在可以在 MacOS X 上本地运行,但仍然不够稳定。 Qt 也适用于大多数智能手机平台,而 Gtk 则不行。
  5. Vala 与 C# 不太相似,但也有其独特之处。

一般来说,我建议使用 Qt。

  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.

×纯※雪 2025-01-02 01:23:41

Vala 编译为 C,大量使用 GObject 类型系统。您可以使用 glibmm 来使用它,它是 C++ 中 gtkmm 的一部分。但你也可以只使用 gtkmm (即使用 GtkBuilder)然后......

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 …

情深缘浅 2025-01-02 01:23:41

它可能无法完全回答您的问题,但如果您使用 mono 将 C# 嵌入到 C++ 中,您可以直接从 Windows 使用 GTK# (它也可以在 mac 和 linux 中编译和运行)。

然后,您将能够使用 C#/GTK# 作为前端,并使用 C++ 编写其余部分。

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++.

萌化 2025-01-02 01:23:41

如果 QT 满足您的要求,您可以使用它。 Qt 是一个跨平台应用程序和 UI 框架,还具有用于 C++ 编程的 API。
http://developer.qt.nokia.com/doc/qt-4.8 /gettingstartedqt.html

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文