Repository navigation
C/C++ intellisense cannot find GCC system include headers on Windows with vscode-cmake-tools as configuration provider #13679
Description
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.
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
dracula-theme.theme-dracula@2.25.1
eamodio.gitlens@17.1.1
formulahendry.code-runner@0.12.2
github.copilot@1.330.0
github.copilot-chat@0.27.3
iarsystems.iar-build@1.30.7
johnstoncode.svn-scm@2.17.0
llvm-vs-code-extensions.lldb-dap@0.2.15
ms-dotnettools.csharp@2.80.16
ms-dotnettools.vscode-dotnet-runtime@2.3.5
ms-python.python@2025.6.1
ms-python.vscode-pylance@2025.5.1
ms-vscode-remote.remote-wsl@0.99.0
ms-vscode.cmake-tools@1.20.53
ms-vscode.cpptools@1.25.3
ms-vscode.hexeditor@1.11.1
pkief.material-icon-theme@5.23.0
redhat.vscode-xml@0.29.0
redhat.vscode-yaml@1.18.0
rust-lang.rust-analyzer@0.4.2488
visualstudioexptteam.vscodeintellicode@1.3.2
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone

Activity
sean-mcmanus commentedon Jun 9, 2025
Liangliang Ma (@akmll) We're not receiving a configuration from CMake Tools. What does the C/C++ logging pane show after you run CMake: Configure? Do you see "Custom configurations received:"? Do you see the file being processed as C or C++ in the bottom right language status bar? Do you have any files.associations setting a .c file to C++?
sean-mcmanus commentedon Jun 9, 2025
Liangliang Ma (@akmll) Also, this might be a duplicate of #13622, fixed in 1.26.1 pre-release.
akmll commentedon Jun 10, 2025
Hi Sean McManus (@sean-mcmanus), it seems different to #13622. I have tried upgrading the extension to v1.26.1, putting msys2 gcc to the top of the PATH environment, but still having this issue.
I recreated a clean workspace and after the CMake: Configure command I can see "Custom configurations recieved:" in the C/C++ log, as you can see from the attachment.
Another thing to mention is that in the C/C++ log it says "Failed to query command line:" for the GCC compiler but I can successfully run these following 3 commands in the integrated terminal:
c:/tools/msys64/ucrt64/bin/gcc.exe -g -std=c17 -m64 -Wp,-v -E -dM -x c nulc:/tools/msys64/ucrt64/bin/gcc.exe -g -std=c17 -m32 -Wp,-v -E -dM -x c nulc:/tools/msys64/ucrt64/bin/gcc.exe -g -std=c17 -Wp,-v -E -dM -x c nulAll these 3 commands output the same include search paths to stderr, and different predefined macros to stdout.

c_c++.txt
c_c++_diagnostics.txt
sean-mcmanus commentedon Jun 11, 2025
Liangliang Ma (@akmll) The output of the compiler query may not match what we are expecting from a valid query. Can you provide the output from a manual query and/or from what we're logging with C_Cpp.loggingLevel temporarily set to the hidden value of "7"?
sean-mcmanus commentedon Jun 11, 2025
Liangliang Ma (@akmll) Also, I'm not able to repro the issue. Although, I'm using gcc 14.2.
akmll commentedon Jun 12, 2025
Sean McManus (@sean-mcmanus), The content before "End of search list." in the 3 output files below is printed to stderr
c:/tools/msys64/ucrt64/bin/gcc.exe -std=c99 -m64 -Wp,-v -E -dM -x c nul >gcc_query_64bit.txt 2>&1gcc_query_64bit.txt
c:/tools/msys64/ucrt64/bin/gcc.exe -std=c99 -m32 -Wp,-v -E -dM -x c nul >gcc_query_32bit.txt 2>&1gcc_query_32bit.txt
c:/tools/msys64/ucrt64/bin/gcc.exe -std=c99 -Wp,-v -E -dM -x c nul >gcc_query.txt 2>&1gcc_query.txt
c_c++.txt
c_c++_diagnostics.txt
cmake_diagnostics.txt
talraveh1 commentedon Jun 12, 2025
I have exactly the same problem. Switching to the 1.26.1 pre-release version indeed fixes it.
sean-mcmanus commentedon Jun 12, 2025
Tal Raveh (@talraveh1) You're hitting #13622 and not this issue (not finding headers can have many root causes).
sean-mcmanus commentedon Jun 12, 2025
Liangliang Ma (@akmll) The logs don't have enough info on why the query is failing. Can you set C_Cpp.loggingLevel to "7" temporarily and look for the logging after
Compiler query command line:to see if it shows some error or if it shows the correct query results that match your manual query?sean-mcmanus commentedon Jun 12, 2025
Liangliang Ma (@akmll) Your logging shows "Querying compiler for default C++ language standard using command line: c:/tools/msys64/ucrt64/bin/gcc.exe -x c++ -E -dM nul" is occurring 2 times in a row, which can only happen if the call to gcc.exe is returning a non-zero exit code. We can add logging for 1.26.2 to log the exit code.
14 remaining items
sean-mcmanus commentedon Jul 1, 2025
Liangliang Ma (@akmll) Can you install gcc at a location where you have permissions to execute it without requiring admin permission? Or can the permissions of gcc/etc. be changed to allow non-admin execution? But I'm not sure why you'd be able to execute gcc from the terminal unless you also ran the terminal command as an admin?
akmll commentedon Jul 4, 2025
Sean McManus (@sean-mcmanus), gcc is installed to directory that does not require admin permission to run. Infact cmake and other build tools are installed to the same directory and all running properly in vscode.
Could you help to analyze the following process dump of the extension v1.26.3 to see if there is any clue? I can see from windbg that compiler quering process is terminated inside of cpptools!msvc::start_process, but I cannot debug without the source code and symbols.
gcc.exe-(PID-26488)-181872562.zip
sean-mcmanus commentedon Jul 7, 2025
Liangliang Ma (@akmll) The call to TerminateProcess only happens if our calls related to setting properties of a job object fail after starting the process in a suspended state. With Process Monitor, do you cpptools.exe failures related to Windows "Job" calls that are failing after initially launching the process?
sean-mcmanus commentedon Jul 7, 2025
Liangliang Ma (@akmll) We may be able to just ignore the job-related failures and just launch the process anyway -- they are only being set to make sure gcc is terminated when cpptools terminates and to make sure gcc doesn't use too much memory, but I don't think they should be requirements if there's a failure.
sean-mcmanus commentedon Jul 8, 2025
Liangliang Ma (@akmll) Our next 1.27.0 should have a fix for the TerminateProcess after job-related Windows API failures (we're not sure when it'll be released yet).
sean-mcmanus commentedon Aug 7, 2025
Liangliang Ma (@akmll) We have a fix in https://github.com/microsoft/vscode-cpptools/releases/tag/v1.27.0 . Let us know if you're still hitting this issue -- we didn't have a repro so there could be additional failures that happen after the one that we fixed.
akmll commentedon Aug 8, 2025
Sean McManus (@sean-mcmanus), I have tested the v1.27.0 extension, although there is "Failed to enable terminate with parent for process" message in the log, the intellisense seems working properly. Thanks very much for your help.
c_c++.txt