Skip to content

C/C++ intellisense cannot find GCC system include headers on Windows with vscode-cmake-tools as configuration provider #13679

Open
@akmll

Description

@akmll

Environment

  • OS and Version: Windows 11 Enterprise 23H2
  • VS Code Version: 1.100.3
  • C/C++ Extension Version: 1.25.3
  • If using SSH remote, specify OS of remote machine:

Bug Summary and Steps to Reproduce

Bug Summary:

When using msys2 gcc or arm-none-eabi-gcc on Windows with vscode-cmake-tools as C/C++ configuration provider, it works fine to build and debug, and all local header files get parsed correctly, but complaints about could not open source file of all system include headers. It also works correctly on WSL ubuntu/archlinux, so I am assuming it's a Windows specific issue. It doesn't work event with a hello world example as simple as the screenshot below.

Image

Sample source files:
test.zip

Configuration and Logs

No c_cpp_properties.json. All configurations are default except the following ones:
{
    "C_Cpp.loggingLevel": "Debug",
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
    "C_Cpp.default.intelliSenseMode": "windows-gcc-x64",
    "cmake.loggingLevel": "debug"
}

Log Diagnostics:
-------- Diagnostics - 6/9/2025, 2:14:40 PM
Version: 1.25.3
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/workspace/test/test/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "cStandard": "c99",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-gcc-x64",
    "intelliSenseModeIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "mergeConfigurations": false,
    "recursiveIncludes": {},
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPathIsExplicit": false,
    "configurationProvider": "ms-vscode.cmake-tools",
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.intelliSenseMode": "windows-gcc-x64",
    "C_Cpp.default.cStandard": "c99",
    "C_Cpp.default.cppStandard": "c++17",
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
    "C_Cpp.loggingLevel": "Debug"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
Custom browse configuration: 
{
    "browsePath": [
        "c:/workspace/test/test"
    ],
    "compilerPath": "c:/tools/msys64/ucrt64/bin/gcc.exe",
    "compilerArgs": [],
    "compilerFragments": [
        "-g"
    ]
}
cpptools version (native): 1.25.3.0
Current database path: C:\USERS\XXX\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\DD687B0ECF0DFE793C16836AC6A1968E\.BROWSE.VC.DB
Translation Unit Mappings:
[ C:\workspace\test\test\main.c - source TU]:
Translation Unit Configurations:
[ C:\workspace\test\test\main.c ]
    Process ID: 2556
    Memory Usage: 41 MB
    Include paths:
    Standard Version: ms_c17
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 41 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 2

C/C++ logs:
loggingLevel: 6
LSP: (received - deferred) textDocument/didOpen: file:///c%3A/workspace/test/test/main.c
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.25.3
cpptools version (native): 1.25.3.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: Sending response (id: 1)
LSP: (received) cpptools/queryCompilerDefaults (id: 2)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 2)
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\gcc.exe -x c -E -dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\gcc.exe -x c -E -dM /dev/null
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\g++.exe -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\g++.exe -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\g++.exe -x c -E -dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\g++.exe -x c -E -dM /dev/null
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang.exe -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang.exe -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang.exe -x c -E -dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang.exe -x c -E -dM /dev/null
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang++.exe -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang++.exe -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang++.exe -x c -E -dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang++.exe -x c -E -dM /dev/null
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang-cl.exe /TP /clang:-E /clang:-dM nul
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang-cl.exe /TP /clang:-E /clang:-dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang-cl.exe /TC /clang:-E /clang:-dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang-cl.exe /TC /clang:-E /clang:-dM /dev/null
LSP: Sending response (id: 2)
LSP: (received) cpptools/didChangeCppProperties (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 3)
Code browsing service initialized
Populating file name cache...
Done populating filename cache. Elapsed time: 7 ms
Unable to configure for compiler cl.exe.
Unable to configure for compiler cl.exe.
  Folder: C:\WORKSPACE\TEST\TEST will be indexed
LSP: (queued) textDocument/didOpen: file:///c%3A/workspace/test/test/main.c
LSP: Sending response (id: 3)
Custom browse configuration received: {
  "browsePath": [
    "c:/workspace/test/test"
  ],
  "compilerPath": "c:/tools/msys64/ucrt64/bin/gcc.exe",
  "compilerArgs": [],
  "compilerFragments": [
    "-g"
  ]
}
LSP: (invoked) textDocument/didOpen: file:///c%3A/workspace/test/test/main.c
Discovering files...
  Processing folder (recursive): C:\WORKSPACE\TEST\TEST
  Discovering files: 2 file(s) processed
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///c%3A/workspace/test/test/main.c
Requesting a custom configuration for: C:\WORKSPACE\TEST\TEST\MAIN.C
  53 file(s) removed from database
Done discovering files.
Parsing remaining files...
  Parsing: 0 files(s) processed
Done parsing remaining files.
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/getDocumentSymbols: file:///c%3A/workspace/test/test/main.c (id: 4)
LSP: (invoked) cpptools/getDocumentSymbols: file:///c%3A/workspace/test/test/main.c (id: 4)
LSP: Sending response (id: 4)
LSP: (received) cpptools/getCodeActions: file:///c%3A/workspace/test/test/main.c (id: 5)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/workspace/test/test/main.c (id: 5)
LSP: Sending response (id: 5)
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/workspace/test/test/main.c (id: 6)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/workspace/test/test/main.c (id: 6)
LSP: Sending response (id: 6)
LSP: (received) cpptools/getCodeActions: file:///c%3A/workspace/test/test/main.c (id: 7)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/workspace/test/test/main.c (id: 7)
LSP: Sending response (id: 7)
LSP: $/cancelRequest (<unknown/completed>, id: 5)
LSP: (received) cpptools/queryCompilerDefaults (id: 8)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 8)
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM nul
LSP: (received) cpptools/didChangeCustomBrowseConfiguration
LSP: (received) cpptools/clearCustomConfigurations
LSP: (received) cpptools/finishedRequestCustomConfig: file:///c%3A/workspace/test/test/main.c
LSP: (invoked) cpptools/finishedRequestCustomConfig: file:///c%3A/workspace/test/test/main.c
Requesting a custom configuration for: C:\WORKSPACE\TEST\TEST\MAIN.C
LSP: (received) cpptools/finishedRequestCustomConfig: file:///c%3A/workspace/test/test/main.c
LSP: (invoked) cpptools/finishedRequestCustomConfig: file:///c%3A/workspace/test/test/main.c
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\gcc.exe -x c -E -dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\gcc.exe -x c -E -dM /dev/null
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\g++.exe -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\g++.exe -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\g++.exe -x c -E -dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\g++.exe -x c -E -dM /dev/null
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang.exe -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang.exe -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang.exe -x c -E -dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang.exe -x c -E -dM /dev/null
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang++.exe -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang++.exe -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang++.exe -x c -E -dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang++.exe -x c -E -dM /dev/null
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang-cl.exe /TP /clang:-E /clang:-dM nul
Querying compiler for default C++ language standard using command line: C:\tools\msys64\ucrt64\bin\clang-cl.exe /TP /clang:-E /clang:-dM /dev/null
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang-cl.exe /TC /clang:-E /clang:-dM nul
Querying compiler for default C language standard using command line: C:\tools\msys64\ucrt64\bin\clang-cl.exe /TC /clang:-E /clang:-dM /dev/null
LSP: Sending response (id: 8)
LSP: (invoked) cpptools/didChangeCustomBrowseConfiguration
Querying compiler for default C++ language standard using command line: c:/tools/msys64/ucrt64/bin/gcc.exe -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: c:/tools/msys64/ucrt64/bin/gcc.exe -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: c:/tools/msys64/ucrt64/bin/gcc.exe -x c -E -dM nul
Querying compiler for default C language standard using command line: c:/tools/msys64/ucrt64/bin/gcc.exe -x c -E -dM /dev/null
Compiler query command line: c:/tools/msys64/ucrt64/bin/gcc.exe -g -std=c++17 -m64 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: c:/tools/msys64/ucrt64/bin/gcc.exe -g -std=c++17 -m32 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: c:/tools/msys64/ucrt64/bin/gcc.exe -g -std=c++17 -Wp,-v -E -dM -x c++ nul
Attempting to get defaults from C++ compiler in "compilerPath" property: 'c:/tools/msys64/ucrt64/bin/gcc.exe'
Unable to configure for compiler cl.exe.
LSP: (invoked) cpptools/clearCustomConfigurations
Database safe to open.
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Requesting a custom configuration for: C:\WORKSPACE\TEST\TEST\MAIN.C
LSP: (received) cpptools/finishedRequestCustomConfig: file:///c%3A/workspace/test/test/main.c
LSP: (invoked) cpptools/finishedRequestCustomConfig: file:///c%3A/workspace/test/test/main.c
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
IntelliSense update scheduled and TU acquisition started for: file:///c%3A/workspace/test/test/main.c
Populating file name cache...
Done populating filename cache. Elapsed time: 0 ms
Expanding recursive includes for: C:\WORKSPACE\TEST\TEST\MAIN.C
Done expanding recursive includes for: C:\WORKSPACE\TEST\TEST\MAIN.C
Reducing recursive includes for: C:\WORKSPACE\TEST\TEST\MAIN.C
Done reducing recursive includes for: C:\WORKSPACE\TEST\TEST\MAIN.C
sending compilation args for C:\workspace\test\test\main.c
  define: _DEBUG
  define: UNICODE
  define: _UNICODE
  stdver: ms_c17
  intelliSenseMode: windows-msvc-x64
Error squiggles will be disabled in: file:///c%3A/workspace/test/test/main.c
Update IntelliSense time (sec): 0.735
LSP: (received) cpptools/getCodeActions: file:///c%3A/workspace/test/test/main.c (id: 9)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/workspace/test/test/main.c (id: 9)
LSP: Sending response (id: 9)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/workspace/test/test/main.c (id: 10)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/workspace/test/test/main.c (id: 10)
LSP: Sending response (id: 10)

Other Extensions

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Additional context

No response

Metadata

Metadata

Assignees

Labels

Feature: Configuration ProviderRelated to the configurationProvider property, e.g. ms-vscode.cmake-tools, ms-vscode.makefile-tools.Language Servicemore info neededThe issue report is not actionable in its current state

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions