GTK下载windows版本进行gui开发

最近联系上qt上海代理,居然说LGPL也要钱,而且是每台设备收费那种,你们说恶不恶心。


直接下GTK,前面的是代理:


https://ghproxy.net/https://github.com/wingtk/gvsbuild/releases/download/2024.12.0/GTK3_Gvsbuild_2024.12.0_x64.zip


不能用的话就换几个,这里有其他的:


https://mp.weixin.qq.com/s/B9aNNOrVGi_wGEAoXxBkFw


github 的visual studio 使用说明复制下:

Using GTK with Visual Studio

Open Visual Studio and "Create a new project" using the "Empty Project" template

On the left, right click on "Source Files" and choose "Add", then "New Item..." and replace the name 
with main.c

Paste in the following contents, then save the file:

#include <gtk/gtk.h>

static void activate_cb(GtkApplication *app) {
  GtkWidget *window = gtk_application_window_new(app);
  gtk_widget_set_visible(window, true);
}

int main(int argc, char **argv) {
  GtkApplication *app =
      gtk_application_new("org.app", G_APPLICATION_DEFAULT_FLAGS);
  g_signal_connect(app, "activate", G_CALLBACK(activate_cb), NULL);
  return g_application_run(G_APPLICATION(app), argc, argv);
}
Go to your project's settings by right-clicking and choosing "Properties"

screenshot showing the properties item is at the bottom of the context menu

On the left, open "C/C++", then choose "Command Line".

Open "Powershell" and run the command pkg-config --cflags gtk4 --msvc-syntax
Paste the result into the "Additional Options" field at the bottom of the Visual Studio Properties 
window.
screenshot showing the "Additional Options" field to modify

Still in the Visual Studio window, click on "Linker" and choose "Command Line". Do the same thing 
as the last step, except use the output of pkg-config --libs gtk4 --msvc-syntax

Click "OK"

In the top menu bar, click "Debug" and "Start Without Debugging"



本文为3YL原创,转载无需联系,但请注明来自labisart.com。

原创文章不易,如果觉得有帮助,可打赏或点击右侧广告支持:

查看打赏记录

发表评论请遵守党国法律!后台审核后方可显示!
  • 最新评论
  • 总共0条评论
  • Blog v1.1© 2025 labisart.com 版权所有 | 联系:labartwork@163.com