VS Code/Intellisense 如何在 Windows 10 上识别 glib C/C++

How have VS Code/Intellisense recognize glib C/C++ on Windows 10

我正在绞尽脑汁想弄清楚如何让 VS Code 识别 glib。

#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (Q:\code\srctext\text_lexer.c).C/C++(1696)
cannot open source file "glibconfig.h" (dependency of "glib-2.0/gmodule.h")C/C++(1696)

我已经手动构建了 glib,并且有以下 *.dll 和 *.pdb 文件:

但我不知道 vcpkg 安装时是否需要包含它?

我已经使用 vcpkg (Package glib:x86-windows is already installed) 安装了 glib。

谢谢!

我不确定是什么更正组合起作用了,但是当我的 c_cpp_properties.json 文件如下所示时错误消失了。

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32Debug",
            "includePath": [
                "${workspaceFolder}/include/debug/**",
                "C:/sync/name/code/projects/frameworks/projectA/projectA/include/**",
                "C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
                "C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "windows-gcc-x86",
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "${default}",
                "path": [
                    "${workspaceFolder}/include/debug/**",
                    "C:/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
                    "C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
                    "C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
                ]
            },
            "compilerArgs": [],
            "compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
            "forcedInclude": [
                "${default}"
            ]
        },
        {
            "name": "Win64Debug",
            "includePath": [
                "${workspaceFolder}/include/debug/**",
                "D:/backup/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
                "D:/backup/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
                "D:/backup/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "compilerPath": "C:/msys64/mingw64/bin/gcc.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "linux-gcc-x64",
            "compilerArgs": [],
            "browse": {
                "path": [
                    "${workspaceFolder}/include/debug/**",
                    "C:/sync/name/code/projects/frameworks/projectA/projectA/include/debug/**",
                    "C:/sync/name/code/libraries/c c++/GTK/glib/lib/glib-2.0/include",
                    "C:/sync/name/code/libraries/c c++/GTK/glib/include/glib-2.0"
                ],
                "limitSymbolsToIncludedHeaders": true
            }
        }
    ],
    "version": 4
}

不确定 tasks.json 是否有任何影响(坦率地说,Visual Code 的内部运作对我的理解来说是一个不透明、难以理解的斑点),但以防万一:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "C/C++ g++.exe build",
            "command": "C:\msys64\mingw64\bin\g++.exe",
            "args": [
                "/property:GenerateFullPaths=true",
                "/t:build",
                "/consoleloggerparameters:NoSummary",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "--include-directory=C:/sync/name/code/libraries/c c++/GTK/glib/lib/**"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": [
                "$gcc"
            ]
        }
    ]
}