Skip to content

Unable to resolve compilerPath with msys2's GCC #13622

@Katzenwerfer

Description

@Katzenwerfer

Environment

  • OS and Version: Windows 11 24H2 (26100.4061)
  • VS Code Version: 1.100.2
  • C/C++ Extension Version: 1.25.3

Bug Summary and Steps to Reproduce

The extension is unable to resolve the compiler path set in c_cpp_properties.json, which makes it fall back to a default, which it also fails to resolve.

I'm not sure what are the exact steps to reproduce it, but it occurs on a fresh workspace, with a fresh installation of the msys2 environment, with the latest version of the mingw-w64-ucrt-x86_64-gcc package installed.

Configuration and Logs

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:/msys64/ucrt64/bin/g++.exe",
            "intelliSenseMode": "windows-gcc-x64",
            "cStandard": "gnu23",
            "cppStandard": "gnu++23"
        }
    ],
    "version": 4
}


C/C++: Log Diagnostics

-------- Diagnostics - 5/21/2025, 10:26:48 AM
Version: 1.25.3
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Users/[user]/[folder]/repos/[folder]/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "compilerPath": "C:/msys64/ucrt64/bin/g++.exe",
    "intelliSenseMode": "windows-gcc-x64",
    "cStandard": "gnu23",
    "cppStandard": "gnu++23",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPathInCppPropertiesJson": "C:/msys64/ucrt64/bin/g++.exe",
    "mergeConfigurations": false,
    "recursiveIncludes": {},
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.autocompleteAddParentheses": true,
    "C_Cpp.clang_format_sortIncludes": true,
    "C_Cpp.loggingLevel": "Debug",
    "C_Cpp.autoAddFileAssociations": false
}
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": true,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.25.3.0
Current database path: C:\USERS\[user]\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\4E5EE534AAC885FDEF080DF04991D11C\.BROWSE.VC.DB
Translation Unit Mappings:
[ C:\Users\[user]\[folder]\repos\[folder]\src\main.cpp - source TU]:
Translation Unit Configurations:
[ C:\Users\[user]\[folder]\repos\[folder]\src\main.cpp ]
    Process ID: 1132
    Memory Usage: 58 MB
    Include paths:
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 58 MB

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


Language server logging

loggingLevel: 6
LSP: (received - deferred) textDocument/didOpen: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/
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:\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: C:\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM /dev/null
Detected language standard version: c++98
Querying compiler's default target using command line: "C:\msys64\ucrt64\bin\gcc.exe" -dumpmachine
Compiler returned default target value: x86_64-w64-mingw32
Compiler info database not connected - skipping load.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -m64 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -m32 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -Wp,-v -E -dM -x c nul
Attempting to get defaults from C compiler in "compilerPath" property: 'C:\msys64\ucrt64\bin\gcc.exe'
Compiler info database not connected - skipping load.
Unable to configure for compiler cl.exe.
Attempting to get defaults from compiler found on the machine: 'C:\msys64\ucrt64\bin\gcc.exe'
Compiler info database not connected - skipping load.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -m64 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -m32 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -Wp,-v -E -dM -x c nul
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.
Compiler info database not connected - skipping load.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -m64 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -m32 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -Wp,-v -E -dM -x c++ nul
Attempting to get defaults from C++ compiler in "compilerPath" property: 'C:\msys64\ucrt64\bin\gcc.exe'
Compiler info database not connected - skipping load.
Unable to configure for compiler cl.exe.
Attempting to get defaults from compiler found on the machine: 'C:\msys64\ucrt64\bin\gcc.exe'
Compiler info database not connected - skipping load.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -m64 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -m32 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -Wp,-v -E -dM -x c++ nul
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.
LSP: Sending response (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 3)
Compiler info database not connected - skipping load.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -m64 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -m32 -Wp,-v -E -dM -x c nul
LSP: (received) cpptools/didChangeCppProperties (id: 4)
LSP: (received - deferred) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeSettings
LSP: (received) cpptools/didChangeSettings
LSP: (received) cpptools/didChangeSettings
LSP: (received) cpptools/didChangeSettings
LSP: (received - deferred) cpptools/getFoldingRanges: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/ (id: 5)
LSP: $/cancelRequest (cpptools/getFoldingRanges, id: 5)
LSP: Message ignored due to no registered handler: $/setTrace
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -Wp,-v -E -dM -x c nul
LSP: (received) cpptools/didChangeSettings
LSP: (received - deferred) cpptools/getDocumentSymbols: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/ (id: 6)
Attempting to get defaults from C compiler in "compilerPath" property: 'C:\msys64\ucrt64\bin\gcc.exe'
Compiler info database not connected - skipping load.
Unable to configure for compiler cl.exe.
Attempting to get defaults from compiler found on the machine: 'C:\msys64\ucrt64\bin\gcc.exe'
Compiler info database not connected - skipping load.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -m64 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -m32 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c17 -Wp,-v -E -dM -x c nul
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.
Compiler info database not connected - skipping load.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -m64 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -m32 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -Wp,-v -E -dM -x c++ nul
Attempting to get defaults from C++ compiler in "compilerPath" property: 'C:\msys64\ucrt64\bin\gcc.exe'
Compiler info database not connected - skipping load.
Unable to configure for compiler cl.exe.
Attempting to get defaults from compiler found on the machine: 'C:\msys64\ucrt64\bin\gcc.exe'
Compiler info database not connected - skipping load.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -m64 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -m32 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=c++98 -Wp,-v -E -dM -x c++ nul
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.
LSP: Sending response (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 4)
Code browsing service initialized
Populating file name cache...
Querying compiler for default C++ language standard using command line: C:/msys64/ucrt64/bin/g++.exe -x c++ -E -dM nul
Done populating filename cache. Elapsed time: 1 ms
Querying compiler for default C++ language standard using command line: C:/msys64/ucrt64/bin/g++.exe -x c++ -E -dM /dev/null
Detected language standard version: c++98
Querying compiler's default target using command line: "C:/msys64/ucrt64/bin/g++.exe" -dumpmachine
Compiler returned default target value: x86_64-w64-mingw32
Compiler query command line: C:/msys64/ucrt64/bin/g++.exe -std=gnu++23 -m64 -Wp,-v -E -dM -x c++ nul
Compiler query command line: C:/msys64/ucrt64/bin/g++.exe -std=gnu23 -m64 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:/msys64/ucrt64/bin/g++.exe -std=gnu23 -m32 -Wp,-v -E -dM -x c nul
Compiler query command line: C:/msys64/ucrt64/bin/g++.exe -std=gnu++23 -m32 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:/msys64/ucrt64/bin/g++.exe -std=gnu++23 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:/msys64/ucrt64/bin/g++.exe -std=gnu23 -Wp,-v -E -dM -x c nul
Attempting to get defaults from C++ compiler in "compilerPath" property: 'C:/msys64/ucrt64/bin/g++.exe'
Attempting to get defaults from C compiler in "compilerPath" property: 'C:/msys64/ucrt64/bin/g++.exe'
Unable to configure for compiler cl.exe.
Attempting to get defaults from compiler found on the machine: 'C:\msys64\ucrt64\bin\gcc.exe'
Unable to configure for compiler cl.exe.
Attempting to get defaults from compiler found on the machine: 'C:\msys64\ucrt64\bin\gcc.exe'
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=gnu++23 -m64 -Wp,-v -E -dM -x c++ nul
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=gnu23 -m64 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=gnu23 -m32 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=gnu++23 -m32 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=gnu++23 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=gnu23 -Wp,-v -E -dM -x c nul
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.
  Folder: C:\USERS\[user]\[folder]\REPOS\[folder] will be indexed
LSP: (queued) textDocument/didOpen: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/
LSP: (queued) cpptools/didChangeVisibleTextEditors
LSP: (queued) cpptools/getFoldingRanges: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/ (id: 5)
LSP: (queued) cpptools/getDocumentSymbols: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/ (id: 6)
LSP: Sending response (id: 4)
LSP: (invoked) cpptools/getDocumentSymbols: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/ (id: 6)
LSP: (invoked) cpptools/didChangeSettings
Discovering files...
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
Enhanced Colorization is enabled.
LSP: (invoked) cpptools/didChangeSettings
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
Enhanced Colorization is enabled.
LSP: (invoked) cpptools/didChangeSettings
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
Enhanced Colorization is enabled.
LSP: (invoked) cpptools/didChangeSettings
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
Enhanced Colorization is enabled.
  Processing folder (recursive): C:\USERS\[user]\[folder]\REPOS\[folder]
LSP: (invoked) cpptools/didChangeSettings
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
Enhanced Colorization is enabled.
LSP: (invoked) textDocument/didOpen: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/
LSP: Sending response (id: 6)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/ (id: 5)
LSP: Request canceled by server (<unknown/completed>, code: -32802, id: 5)
  Discovering files: 3 file(s) processed
  0 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
IntelliSense update scheduled and TU acquisition started for: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/
Expanding recursive includes for: C:\USERS\[user]\[folder]\REPOS\[folder]\SRC\MAIN.CPP
Done expanding recursive includes for: C:\USERS\[user]\[folder]\REPOS\[folder]\SRC\MAIN.CPP
Reducing recursive includes for: C:\USERS\[user]\[folder]\REPOS\[folder]\SRC\MAIN.CPP
Done reducing recursive includes for: C:\USERS\[user]\[folder]\REPOS\[folder]\SRC\MAIN.CPP
sending compilation args for C:\Users\[user]\[folder]\repos\[folder]\src\main.cpp
  define: _DEBUG
  define: UNICODE
  define: _UNICODE
  stdver: ms_c++17
  intelliSenseMode: windows-msvc-x64
Update IntelliSense time (sec): 0.047
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/ (id: 7)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/Users/[user]/[folder]/repos/[folder]/src/main.cpp/ (id: 7)
LSP: Sending response (id: 7)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions