Skip to content

Unable to resolve compilerPath with msys2's GCC #13622

Closed

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

Activity

  1. Katzenwerfer commented on May 21, 2025

    @Katzenwerfer
    Author

    For the record, this occurs even when the C/C++ extension is the only one enabled in the editor.

  2. bobbrow commented on May 21, 2025

    @bobbrow
    Contributor

    Hi Jones (@Katzenwerfer),

    We received a recent report similar to this but we were unable to reproduce the problem and the thread eventually died. Can you look at this comment: #13519 (comment) and check if those steps improve the situation for you?

    You can also try running the compiler query command directly in a CMD shell and see if you are able to get more error details. C:\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM /dev/null

  3. Katzenwerfer commented on May 21, 2025

    @Katzenwerfer
    Author

    We received a recent report similar to this but we were unable to reproduce the problem and the thread eventually died. Can you look at this comment: #13519 (comment) and check if those steps improve the situation for you?

    Path-wise, I have everything set correctly. I'm sure that can be corroborated by calling GCC through any shell, which works fine on my end.

    You can also try running the compiler query command directly in a CMD shell and see if you are able to get more error details. C:\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM /dev/null

    I also found no issues whenever I tried compiling a random file. However, I did find an issue querying that in a fresh CMD shell.

    Image

    My first guess is that something broke in the package with a recent update. If that's the case, I'll try reporting it to the msys2 team.

  4. Colengms commented on May 21, 2025

    @Colengms
    Contributor

    Hi Jones (@Katzenwerfer) . When querying a compiler, in order to support MSYS64, the C/C++ Extension will temporarily add the compiler's path to the PATH environment variable. To run the query manually, I'd suggest:

    cd C:\msys64\ucrt64\bin
    C:\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM nul
    

    (Note the use of the nul version of the command, which is tried first and worked for me.)

    You might consider checking your system's PATH environment variable for issues that might cause it to misinterpret a path added to the end.

    Also, if you temporarily set "C_Cpp.loggingLevel": "7", that will cause log output to be very verbose but will include the actual output of the compiler query attempt.

  5. bobbrow commented on May 21, 2025

    @bobbrow
    Contributor

    oh, wow, I didn't even realize I lifted a /dev/null from the logs and put it in my comment. That must have been from a Cygwin query attempt. Bad luck on my part. 😄

  6. Katzenwerfer commented on May 21, 2025

    @Katzenwerfer
    Author

    Hi @Katzenwerfer . When querying a compiler, in order to support MSYS64, the C/C++ Extension will temporarily add the compiler's path to the PATH environment variable. To run the query manually, I'd suggest:

    cd C:\msys64\ucrt64\bin
    C:\msys64\ucrt64\bin\gcc.exe -x c++ -E -dM nul
    

    That seemed to run fine...

    You might consider checking your system's PATH environment variable for issues that might cause it to misinterpret a path added to the end.

    I wouldn't know why it wouldn't work from outside that path. I guess I might have installed something that is messing with the user/system Path, but then I wouldn't know how to spot that, and for all I know both have been the same for a while now.

    Also, if you temporarily set "C_Cpp.loggingLevel": "7", that will cause log output to be very verbose but will include the actual output of the compiler query attempt.

    Tried that, but I couldn't spot any meaningful output that wasn't included in the log in the original post.

  7. Colengms commented on May 21, 2025

    @Colengms
    Contributor

    Tried that, but I couldn't spot any meaningful output that wasn't included in the log in the original post.

    With that setting set, I get the following:

    Compiler query command line: C:\msys64\ucrt64\bin\gcc.exe -std=gnu++17 -m64 -Wp,-v -E -dM -x c++ nul
    #define __DBL_MIN_EXP__ (-1021)
    <-- lots of other #defines -->
    ignoring nonexistent directory "C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/include"
    ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../include/c++/14.2.0"
    ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../include/c++/14.2.0/x86_64-w64-mingw32"
    ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../include/c++/14.2.0/backward"
    ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/14.2.0/include"
    ignoring nonexistent directory "D:/a/msys64/ucrt64/include"
    ignoring nonexistent directory "/ucrt64/include"
    ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/14.2.0/include-fixed"
    ignoring nonexistent directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/include"
    ignoring nonexistent directory "D:/a/msys64/ucrt64/include"
    #include "..." search starts here:
    #include <...> search starts here:
     C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../include/c++/14.2.0
     C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../include/c++/14.2.0/x86_64-w64-mingw32
     C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../include/c++/14.2.0/backward
     C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/include
     C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../include
     C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/include-fixed
    End of search list.
    

    If you're not seeing any additional information at all, that would seem to imply that the compiler cannot be executed at all for some reason. Could you try launching VS Code as Administrator, to see if that avoids the issue? If so, it may have something to do with security settings on your machine.

    Also, do you have a secondary machine (or VM instance) to try this on? Since this is working for me locally, I suspect it has something to do with your environment. Whether or not this works for you in another environment may narrow things down.

  8. Colengms commented on May 21, 2025

    @Colengms
    Contributor

    It's interesting that 2 of the 3 types of queries were successful:

    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
    

    Another interesting thing I'm noticing is that all of the queries that were passed nul appear to have failed, while one of the above successful results involved use of /dev/null. That is behavior I would expect from Cygwin, not MSYS64+MinGW+ucrt64. nul works for me locally. When you manually ran the query successfully, did you use nul or /dev/null?

    Could you check the version of gcc you have installed? I get the following:

    C:\msys64\ucrt64\bin>"C:\msys64\ucrt64\bin\gcc.exe" --version
    gcc.exe (Rev3, Built by MSYS2 project) 14.2.0
    Copyright (C) 2024 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
  9. Katzenwerfer commented on May 21, 2025

    @Katzenwerfer
    Author

    Also, do you have a secondary machine (or VM instance) to try this on? Since this is working for me locally, I suspect it has something to do with your environment. Whether or not this works for you in another environment may narrow things down.

    I could spin-up a VM to try a fresh environment, though I think I narrowed it down. I have Meld installed and added to my system path. It seems like some libraries in the folder were overriding msys2's. To confirm it, I isolated all DLLs from both and tried querying again within each set, and indeed, Meld's files were the ones causing the issue.

    Moving msys2's folders higher in my system path fixes it. Though, I do have to wonder how I never noticed this before.

  10. Colengms commented on May 21, 2025

    @Colengms
    Contributor

    Hi Jones (@Katzenwerfer) . I think we can mitigate this type of issue by temporarily adding the compiler's path to the start of the list of PATHs instead of the end, when querying a compiler.

  11. Katzenwerfer commented on May 21, 2025

    @Katzenwerfer
    Author

    Hi @Katzenwerfer . I think we can mitigate this type of issue by temporarily adding the compiler's path to the start of the list of PATHs instead of the end, when querying a compiler.

    Yeah, that works fine. I'll be closing this now.

    When querying a compiler, in order to support MSYS64, the C/C++ Extension will temporarily add the compiler's path to the PATH environment variable.

    I do think it's weird that it fails the queries, since the folder is added to the path by the extension when doing them. I would've assumed it would get higher priority, but I guess not.

  12. Katzenwerfer commented on May 21, 2025

    @Katzenwerfer
    Author

    For the record, the conflicting file was Meld's libwinpthread-1.dll.

    This issue on the MSYS2-packages repository recommends checking for other folders in the path that include that file.
    msys2/MSYS2-packages#5389 (comment)

  13. sean-mcmanus commented on May 23, 2025

    @sean-mcmanus
    Contributor
  14. locked and limited conversation to collaborators on Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions