GTK4 环境配置

2023-12-30 23:35:27

?1 安装gtk4包裹:

# sudo yum install gtk4 gtk4-devel gtk4-devel-docs devhelp glib2 glib2-devel glib2-doc

2 安装 glade 4

git clone https://github.com/ag-python/cambalache.git

记住 把软件目录 复制到 一个你不会移动删除的地方(千万别删除这个软件文件夹 因为运行软件需要它)? 因为权限问题 你得

# sudo chown -R *** 软件文件夹名

我们开始安装? cambalache :

# sudo yum install meson

# mkdir _build && cd _build
# meson --prefix=/usr/local?????????????? # 记住这里缺什么包裹安装什么包裹 全部是 -devel的包裹

???????????????????????????????????????????????????????? # 显示包裹为? liba-1 你就改为 liba-devel? 如果不是自己

???????????????????????????????????????????????????????????? 用yum找一下


# ninja
# ninja install

运行它非常简单? 找到软件包裹里的 run-dev.py

# ./run-dev.py

3? 配置vscode :

tasks.json 文件这样配置 :

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc build active file",
            "command": "/usr/bin/gcc",
            "args": [
                "`pkg-config --cflags gtk4`",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "`pkg-config --libs gtk4`",
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

settings.json 文件这样配置 :

{
    "files.associations": {
        "glib.h": "c",
        "gtk.h": "c",
        "gstdio.h": "c"
    },
    "C_Cpp.errorSquiggles": "disabled"
}


c_cpp_properties.json 文件这样配置:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/include/glib-2.0",
                "/usr/include/gtk-4.0"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "linux-clang-x64",
            "compilerArgs": [
                "`pkg-config --cflags --libs gtk4`"
            ]
        }
    ],
    "version": 4
}

文章来源:https://blog.csdn.net/nn_84/article/details/135310877
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。