无法打开源文件"glibconfig.h"; (依赖于"gtk/gtk.h")在Studio代码中 [英] cannot open source file "glibconfig.h" (dependency of "gtk/gtk.h") in Studio Code

查看:301
本文介绍了无法打开源文件"glibconfig.h"; (依赖于"gtk/gtk.h")在Studio代码中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Visual Studio Code中配置了任务json

I've configured the task json in Visual Studio Code

{
    "tasks": [
        {
            "type": "shell",
            "label": "gcc build active file",
            "command": "/usr/lib64/ccache/gcc",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "`pkg-config", "--cflags", "--libs","gtk+-3.0`"
            ],
            "options": {
                "cwd": "/usr/lib64/ccache"
            },
            "problemMatcher": [],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ],
    "version": "2.0.0"
}

我认为终端输出没问题,它的构建没有问题:

And I think the terminal output is ok,it builds without issues:

> Executing task: /usr/lib64/ccache/gcc -g /home/giuliohome/dev/gnome/gtk-example/gtk_hello02.c -o /home/giuliohome/dev/gnome/gtk-example/gtk_hello02 `pkg-config --cflags --libs gtk+-3.0` <

出于一个我不太了解的奇怪原因,Visual Studio代码编辑器需要在.vscode/c_cpp_properties.json中使用不同的单独配置,并且它仍然在#include <gtk/gtk.h>

For a strange reason, that I don't deeply understand, the Visual Studio Code editor needs a different, separate configuration in .vscode/c_cpp_properties.json and it still complains with squiggles under the #include <gtk/gtk.h>

问题消息说明:

无法打开源文件"glibconfig.h"(依赖于"gtk/gtk.h")

cannot open source file "glibconfig.h" (dependency of "gtk/gtk.h")

我试图做的是已经通过目视检查/usr/inlcude结构添加了3个Dirs

What I've tried to do was already adding 3 dirs by visual inspection of my /usr/inlcude structure

但是(因为它包含很多文件和子文件夹),我为此困惑不解(我应该继续搜索所有嵌套的包含依赖项?),无论如何我都不知道要添加什么下一个...

but (since it contains a lot of file and subfolders) I'm perplexed by this way to proceed (I'm I supposed to keep searching all those nested include dependencies?) and anyway I don't know what to add next...

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/include/linux",
                "/usr/include/gtk-3.0",
                "/usr/include/glib-2.0"
            ],
            "defines": [],
            "compilerPath": "/usr/lib64/ccache/gcc",
            "cStandard": "c11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

推荐答案

两年后,这仍然是很明显,无论如何,对于您的信息来说,它是不可管理的,这是我的Fedora 31 Linux工作站上的解决方案:

It is obvious that it is not manageable, anyway, for your info, this is the solution on my Fedora 31 Linux workstation:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/include/linux",
                "/usr/include/gtk-3.0",
                "/usr/include/glib-2.0",
                "/usr/lib64/glib-2.0/include",
                "/usr/include/pango-1.0",
                "/usr/include/harfbuzz",
                "/usr/include/cairo",
                "/usr/include/gdk-pixbuf-2.0",
                "/usr/include/atk-1.0"
            ],
            "defines": [],
            "compilerPath": "/usr/lib64/ccache/gcc",
            "cStandard": "c11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

这篇关于无法打开源文件"glibconfig.h"; (依赖于"gtk/gtk.h")在Studio代码中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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