【发布时间】:2020-05-25 10:20:25
【问题描述】:
我已经在 Visual Studio Code 中配置了任务 json
{
"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"
}
而且我认为终端输出没问题,它构建没有问题:
> 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 Code 编辑器需要在 .vscode/c_cpp_properties.json 中进行不同的单独配置,并且它仍然在 #include <gtk/gtk.h> 下抱怨 squiggles
问题信息说明:
无法打开源文件“
glibconfig.h”(依赖于“gtk/gtk.h”)
我已经尝试通过目视检查我的 /usr/inlcude 结构添加 3 个目录
但是(因为它包含很多文件和子文件夹)我对这种方式感到困惑(我应该继续搜索所有嵌套的包含依赖项?)无论如何我不知道要添加什么接下来...
{
"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
}
【问题讨论】:
标签: c gcc visual-studio-code gtk