在 Windows 上开发的 Gtk3 [英] Gtk3 developing on windows

查看:33
本文介绍了在 Windows 上开发的 Gtk3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 C++ 和 SO 的新手(相对而言).

I am new (relatively) to C++ and to SO.

在将控制台应用程序的创造力发挥到极致之后,我非常狂热的头脑现在想知道如何编写 GUI.我做了一些研究,决定使用 GTK 而不是 Qt,因为有选择的自由,没有附加条件,还有一些关于互联网速度慢的问题,如果我选择 Qt,我必须下载一些 0.6GB.

Having stretched the creativity of console applications to the limit, my very rabid mind wants to know how to code GUIs now. I did some research, decided to use GTK rather than Qt because of having freedom of choice, there being no strings attached and something about slow internet and having to download some 0.6GB were I to go with Qt.

尝试在 Gtk 上构建Hello World"是一个残酷的 48 小时.这是我发脾气.我正在使用 Visual Studio 2010.也许这就是我所有烦恼的根源.似乎 Gtk 是为 C 而不是 C++ 设计的.在解决了头文件包含的问题和某个臭名昭著的 glibconfig.h 丢失(我从互联网上下载后,我惊恐地发现它应该是一个生成的文件)后,编译器抛出语法错误,尤其是在一个 gatomic.h 中.

It has been a brutal 48 hours trying to build 'Hello World' on Gtk. This is me throwing a tantrum. I'm using Visual Studio 2010. Perhaps this is the source of all my woes. It seems Gtk is meant for C and not C++. After solving issues with header files includes and a certain notorious glibconfig.h missing (which I downloaded from the internet only to find, to my horror,that it is supposed to be a generated file), the compiler threw syntax errors,especially in one gatomic.h.

我怀疑我设法解决的每一个错误都会出现 10 个错误.这就是你进来的地方.你使用Gtk开发c++吗?如果不是,为什么会这样?你会推荐什么?你在 Windows 上使用 Gtk 吗?这怎么可能?请详细说明.

I suspect 10 errors will come up for every one I manage to solve. This is where you come in. Do you use Gtk to develop c++? If not, why so? What would you recommend instead? Do you use Gtk on windows? How is that possible? Please give details.

是否可以制作使用 C++ 代码和 Python/VB GUI 的跨平台应用程序?

Is it possible to make cross-platform apps that use C++ code and a Python/VB GUI?

真诚地感谢您的回答.

推荐答案

首先,一般说明:Gtk 主要是作为 Gnome 的工具包开发的,我认为可以公平地说,主要关注点是在 Linux 上的高质量而其他平台则有些二等公民.通过查看与 Windows 和 MacOS 的本机外观和感觉的集成,这可能是最明显的.如果您正在寻找在所有主要平台上表现同样出色的工具包,我建议您重新考虑 Qt.

First off, a general note: Gtk being mainly developed as a toolkit for Gnome, I think it is fair to say that the main focus is high quality on Linux while other platforms are somewhat second-class citizens. This is probably most visible by looking at the integration with the native look and feel of Windows and MacOS. If you are looking for a toolkit which behaves equally well on all major platforms, I'd recommend you reconsidered Qt.

就您更具体的问题而言:

As far as your more specific questions are concerned:

C/C++

Gtk 是用 C 编写的,因此有一个 C API.如果您正在寻找 C++ API,请查看 Gtkmm 绑定.请注意,您也可以在 C++ 应用程序中使用 C API.

Gtk is written in C, and consequently has a C API. If you are looking for a C++ API, look at the Gtkmm bindings. Note that you can also use the C API in a C++ application.

glibconfig.h

我不知道您是否尝试过自己编译 Gtk,但是获得 Windows 版 Gtk3 的最简单方法是从 http://www.gtk.org/download/win32.php(包括您缺少的 glibconfig.h).

I don't know whether you tried compiling Gtk yourself, but the easiest way to get Gtk3 for windows is by downloading the precompiled all-in-one bundle from http://www.gtk.org/download/win32.php (which includes the glibconfig.h you are missing).

何时以及如何使用 Gtk 以及使用什么语言

如上所述,Gtk 的主要用户是为 Gnome 桌面环境开发应用程序的人.然而,现在大多数跨平台应用程序都使用 Qt,因为与这些平台上的 Gtk 相比,它们在 Windows 和 MacOS 上的质量更高.

As pointed out above, the primary users oft Gtk are people who develop applications for the Gnome desktop environment. Most cross-platform applications nowadays however use Qt since the quality on Windows and MacOS is higher compared to Gtk on those platforms.

关于使用什么语言,Gtk 的一个优势是存在许多语言(包括 C++ 和 Python)的绑定,所以你当然不限于 C.

Concerning what langauge to use, a strength of Gtk is that there exists bindings for many languages (including C++ and Python), so you are certainly not confined to C.

当用 C++ 开发时,我个人喜欢 Gtkmm 的一点是它使用标准库,而不是 Qt,它有自己的数据结构实现等(原因是 Qt 早于 STL 的时代通常是可在所有主要平台上使用).

When developing with C++, something that I personally like about Gtkmm is that it uses the standard library, as opposed to Qt which has it's own implementations for data structures etc (the reason being that Qt predates the times when the STL was generally available and usable on all main platforms).

如何使用Gtk:与拥有优秀Qt Creator的Qt相反,Gtk在某种程度上缺乏专门设计的易于开发的IDE.您将获得的关闭是使用 Glade 进行界面设计,并使用您选择的文本编辑器或 IDE 进行编码,但该选择将根据您所在的平台而有所不同.显然,正如您可能注意到的那样,将 Gtk 集成到选择的环境中通常需要一些工作(以及更多的技术知识).再说一次,如果您正在寻找一个易于设置和使用的环境来开发 GUI 应用程序,我会选择 Qt 和 Qt Creator.

How to use Gtk: contrary to Qt which has the excellent Qt Creator, Gtk is somewhat lacking a specifically designed IDE for easy development. The closes you'll get is using Glade for interface design and a text editor or IDE of your choice for the coding, but that choice will differ depending on the platform you are on. Clearly, as you probably noticed, integrating Gtk into the environment of choice usually requires some work (and also some more technical knowledge). So again, if you are looking for an easy to set-up and use environment for developing GUI applications, I'd just go with Qt and Qt Creator.

跨平台应用

首先,Visual Basic 不是跨平台的.但总的来说,使用各种语言进行跨应用程序开发有很多可能性.

First off, Visual Basic is not cross-platform. But generally speaking, there are plenty of possibilities for doing cross-application development, using various languages.

这篇关于在 Windows 上开发的 Gtk3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆