windows - 如何在 gtk 应用程序中隐藏控制台

标签 windows gtk vala

例如,我有一个类似的简单 gtk 应用程序:

public class Application : Gtk.Window {
    public Application () {
        this.title = "Zaebis";
        this.window_position = Gtk.WindowPosition.CENTER;
        this.destroy.connect (Gtk.main_quit);
        this.set_default_size (170, 70);
        Gtk.Button button = new Gtk.Button.with_label ("Make everything zaebis");
        this.add (button);
        button.clicked.connect (() => {
            button.label = "Everything is zaebis now";
            });
        }
    public static int main (string[] args) {
        Gtk.init (ref args); (new Application ()).show_all ();
        Gtk.main (); return 0;
        }
    }

我编译它 valac --pkg gtk+-2.0 main.vala 但是当我运行它时我也看到空的控制台。 如何不显示/隐藏此控制台并仅显示我的窗口?

最佳答案

您是否在 Windows 中运行此程序?

来自 https://wiki.gnome.org/Vala/ValaOnWindows :

In order to suppress the additional console window for GTK+ applications you have to take the following steps:

  • Download MinGW API for MS-Windows
  • Extract w32api-x.xx-mingw32-dev.tar.gz into the Vala/MinGW installation directory
  • Pass -X -mwindows to the Vala compiler:

    valac -X -mwindows --pkg gtk+-2.0 hellogtk.vala
    

关于windows - 如何在 gtk 应用程序中隐藏控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18592643/

相关文章:

c++ - gtkmm intltool 无库存翻译

c - GTK+ 程序中带有标签的文本框

colors - 将 8 位颜色分量转换为 16 位颜色分量

dictionary - 将函数应用于 vala 数组的每个元素

vala - 无法创建 SinkInputInfo 数组

windows - 使用 Notepad++ 编辑 DOT 文件

windows - FAT-32 上的 Unicode 文件名?

c++ - Visual Studio 平台工具集与 Windows SDK

python - 如何在Windows上从C中的CreateProcess执行Python脚本?

gtk - 如何将自定义函数连接到 GTK 按钮的单击操作?