vscode新建cmake專案ctrl左鍵無法索引標頭檔案

正明小佐發表於2024-10-30

生成c_cpp_properties.json檔案

  • 開啟命令皮膚ctrl+shift+p,輸入[c/c++:]edit configuration(UI)[c/c++:]edit configuration(JSON)即可生成;
  • 新增includePath,例如:
{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/include",
                "/path/to/thirdparty/include"
            ],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

相關文章