-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Environment
OS and Version: Windows_NT x64 10.0.26100
VS Code Version: 1.102.2 (c306e94f98122556ca081f527b466015e1bc37b0)
C/C++ Extension Version: 1.26.3
msys2 Version: MINGW64_NT-10.0-26100 version 3.6.3-1f8def9f.x86_64 (runneradmin@fv-az1622-166) (gcc version 13.4.0 (GCC) ) 2025-06-18 07:19 UTC
g++ Version: 15.1.0
ninja Version: 1.12.1
Bug Summary and Steps to Reproduce
Bug Summary:
Simple cmake project with single soure file.
Compile commands are generated by Ninja when building with cmake.
The c_cpp_properties.json contains the compileCommands property which refers to the compile_commands.json file.
The extension reads the compile commands when opening a file.
I get the following log from C/C++ configuration Warnings:
Unable to resolve configuration with compilerPath "C:\msys64\ucrt64\bin\c++.exe". Using "cl.exe" instead.
With debug log enabled I found that the extension fails when querying the compiler:
Compiler query command line: C:\msys64\ucrt64\bin\c++.exe -std=gnu++23 -ggdb -municode -fmodules-ts -fmodule-mapper=CMakeFiles\msys.dir\main.cpp.obj.modmap -fdeps-format=p1689r5 -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\c++.exe -std=gnu++23 -ggdb -municode -fmodules-ts -fmodule-mapper=CMakeFiles\msys.dir\main.cpp.obj.modmap -fdeps-format=p1689r5 -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\c++.exe -std=gnu++23 -ggdb -municode -fmodules-ts -fmodule-mapper=CMakeFiles\msys.dir\main.cpp.obj.modmap -fdeps-format=p1689r5 -Wp,-v -E -dM -x c++ nul
**cc1plus.exe: error: to generate dependencies you must specify either '-M' or '-MM'**
When I change the CXX_STANDARD version to 17 this error does not occur and everything works.
Only seems to happen with CXX_STANDARD version 20 and 23 which results in the compiler option -std=gnu++20 and 23 respectively.
Steps to reproduce:
- Install mingw ucrt toolchain in msys2 via:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
. - Install C/C++ extension via vscode marketplace.
- Run cmake build to generate compile_commands.json.
- Reopen project/c++ source file to load compile_commands.json via extension.
Expected behavior:
I expect the extension to resolve the compilerPath instead of being unable to do so due to some flag not being passed to cc1plus.exe.
Configuration and Logs
CMakeLists.txt
cmake_minimum_required(VERSION 3.28)
project(msys LANGUAGES CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(-ggdb)
add_compile_options(-Werror)
add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Wpedantic)
add_compile_options(-Wconversion)
add_compile_options(-Wno-unused-variable)
set(CMAKE_CXX_STANDARD 23)
if(WIN32)
add_compile_options(-municode)
add_executable(msys WIN32)
else()
add_executable(msys)
endif()
target_sources(msys PRIVATE main.cpp)
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"intelliSenseMode": "windows-gcc-x64"
}
],
"version": 4
}
logs from C/C++
loggingLevel: 6
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.26.3
cpptools version (native): 1.26.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)
Compiler info database not connected - skipping load.
Compiler info database not connected - skipping load.
LSP: Sending response (id: 2)
LSP: (received) cpptools/didChangeCppProperties (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 3)
LSP: (received - deferred) cpptools/didChangeVisibleTextEditors
LSP: (received - deferred) cpptools/didChangeVisibleTextEditors
Code browsing service initialized
Populating file name cache...
Querying compiler for default C++ language standard using command line: C:\msys64\ucrt64\bin\c++.exe -x c++ -E -dM nul
Detected language standard version: gnu++17
Querying compiler's default target using command line: "C:\msys64\ucrt64\bin\c++.exe" -dumpmachine
Compiler returned default target value: x86_64-w64-mingw32
Compiler query command line: C:\msys64\ucrt64\bin\c++.exe -std=gnu++23 -ggdb -municode -fmodules-ts -fmodule-mapper=CMakeFiles\msys.dir\main.cpp.obj.modmap -fdeps-format=p1689r5 -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\c++.exe -std=gnu++23 -ggdb -municode -fmodules-ts -fmodule-mapper=CMakeFiles\msys.dir\main.cpp.obj.modmap -fdeps-format=p1689r5 -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\c++.exe -std=gnu++23 -ggdb -municode -fmodules-ts -fmodule-mapper=CMakeFiles\msys.dir\main.cpp.obj.modmap -fdeps-format=p1689r5 -Wp,-v -E -dM -x c++ nul
cc1plus.exe: error: to generate dependencies you must specify either '-M' or '-MM'
ignoring nonexistent directory "C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../x86_64-w64-mingw32/include"
ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../include/c++/15.1.0"
ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../include/c++/15.1.0/x86_64-w64-mingw32"
ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../include/c++/15.1.0/backward"
ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/15.1.0/include"
ignoring nonexistent directory "C:/a/msys64/ucrt64/include"
ignoring nonexistent directory "/ucrt64/include"
ignoring duplicate directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/15.1.0/include-fixed"
ignoring nonexistent directory "C:/msys64/ucrt64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "C:/a/msys64/ucrt64/include"
#include "..." search starts here:
#include <...> search starts here:
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../include/c++/15.1.0
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../include/c++/15.1.0/x86_64-w64-mingw32
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../include/c++/15.1.0/backward
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.1.0/include
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../include
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/15.1.0/include-fixed
End of search list.
Compiler querying failed: rc=0, exit_code=1
Attempting to get defaults from C++ compiler in compile_commands.json file: 'C:\msys64\ucrt64\bin\c++.exe'
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\CPPWINRT will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\SHARED will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UCRT will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UM will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\WINRT will be indexed
Folder: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.44.35207\ATLMFC\INCLUDE will be indexed
Folder: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.44.35207\INCLUDE will be indexed
Folder: C:\USERS\LUCAS\HOME\MSYS-TEST will be indexed
LSP: (queued) cpptools/didChangeVisibleTextEditors
LSP: (queued) cpptools/didChangeVisibleTextEditors
LSP: Sending response (id: 3)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Discovering files...
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\SHARED
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\CPPWINRT
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UM
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UCRT
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\WINRT
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Processing folder (non-recursive): C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.44.35207\ATLMFC\INCLUDE
Processing folder (non-recursive): C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.44.35207\INCLUDE
Processing folder (recursive): C:\USERS\LUCAS\HOME\MSYS-TEST
Done populating filename cache. Elapsed time: 320 ms
Discovering files: 5077 file(s) processed
LSP: Message ignored due to no registered handler: $/setTrace
LSP: (received) cpptools/didChangeSettings
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: (received) cpptools/didChangeCompileCommands: file:///c%3A/Users/Lucas/home/msys-test/build/compile_commands.json
LSP: (invoked) cpptools/didChangeCompileCommands: file:///c%3A/Users/Lucas/home/msys-test/build/compile_commands.json
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
5181 file(s) removed from database
Done discovering files.
Parsing remaining files...
Parsing: 0 files(s) processed
Done parsing remaining files.
Database safe to open.
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
compile_commands.json
[
{
"directory": "C:/Users/Lucas/home/msys-test/build",
"command": "C:\\msys64\\ucrt64\\bin\\c++.exe -std=gnu++23 -ggdb -Werror -Wall -Wextra -Wpedantic -Wconversion -Wno-unused-variable -municode -fmodules-ts -fmodule-mapper=CMakeFiles\\msys.dir\\main.cpp.obj.modmap -MD -fdeps-format=p1689r5 -x c++ -o CMakeFiles\\msys.dir\\main.cpp.obj -c C:\\Users\\Lucas\\home\\msys-test\\main.cpp",
"file": "C:\\Users\\Lucas\\home\\msys-test\\main.cpp",
"output": "CMakeFiles\\msys.dir\\main.cpp.obj"
}
]
Other Extensions
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status