You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The wildcard can't be used by the C/C++ compiler recommanded! #13096
When I browsed the doc of GCC on Windows,I found that I could modify my tasks.json file to build multiple C++ files by using an argument like "${workspaceFolder}/*.cpp" instead of "${file}". But there is a fatal error when I run my program. The information is that *.cpp is invalid argument.
What is interesting is that my program runs sucessfully if I use another compiler downloaded from https://winlibs.com/.
Yes, g++ means D:\msys64\ucrt64\bin\g++.exe which is downloaded by msys2 that vscode document recommended.
I have tried many times in the command line and also in tasks.json.
You can download the msys2 and then input the command "pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
" according to https://code.visualstudio.com/docs/cpp/config-mingw.
Finally, at windows10 environment, you can try the command "g++ *.cpp -o filename.exe". There will be a fatal error.
If the issue reproduces when you just use the command line, then the issue may have to do with your shell and not our extension. I am not able to reproduce your behavior using the same compiler.
It wasn't clear based on your response if you have tried compiling with the full path. Can you confirm that doesn't work?
Did you ensure the ucrt compiler was added to your PATH environment variable?
No,the issue also happened in tasks.json. The shell is powershell of windows10.
I did add the ucrt compiler to the PATH environment variable. I can be sure that I also tried full path command compile. That made a fatal error.
I have also communicated with some friends on the internet. They also found there is a fatal error.
pwsh
cmd
tasks.json
If the issue reproduces when you just use the command line, then the issue may have to do with your shell and not our extension. I am not able to reproduce your behavior using the same compiler.
It wasn't clear based on your response if you have tried compiling with the full path. Can you confirm that doesn't work?
Did you ensure the ucrt compiler was added to your PATH environment variable?
https://code.visualstudio.com/docs/cpp/config-mingw recommends using gcc from msys2, which was not configured with --enable-mingw-wildcard, thus the wildcard expansion only works in msys bash shell, not the integrated terminal where tasks.json is used.
However gcc from winlibs is configured with --enable-mingw-wildcard.
If the issue reproduces when you just use the command line, then the issue may have to do with your shell and not our extension. I am not able to reproduce your behavior using the same compiler.
It wasn't clear based on your response if you have tried compiling with the full path. Can you confirm that doesn't work?
Did you ensure the ucrt compiler was added to your PATH environment variable?
https://code.visualstudio.com/docs/cpp/config-mingw recommends using gcc from msys2, which was not configured with --enable-mingw-wildcard, thus the wildcard expansion only works in msys bash shell, not the integrated terminal where tasks.json is used.
However gcc from winlibs is configured with --enable-mingw-wildcard.
SainoNamkho Thank you for providing this additional context, it looks like MSYS2 decided to change their compiler behavior at the end of the year. We will update our documentation to reflect this change in behavior.
Activity
WangShiSuiFeng24 commentedon Dec 28, 2024
The recommanded compiler is installed by msys2 with the command line "pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain

"
browntarik commentedon Jan 2, 2025
Could you provide more information about this compiler you are using? What is the exact path of "g++" in the command line?
Does this repro when you use the full path to the ucrt version of the compiler (i.e "C:/msys64/ucrt64/bin/g++.exe") in the command line?
Does the issue reproduce without using the cppbuild task and just the command line?
WangShiSuiFeng24 commentedon Jan 4, 2025
Yes, g++ means D:\msys64\ucrt64\bin\g++.exe which is downloaded by msys2 that vscode document recommended.
I have tried many times in the command line and also in tasks.json.
You can download the msys2 and then input the command "pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
" according to https://code.visualstudio.com/docs/cpp/config-mingw.
Finally, at windows10 environment, you can try the command "g++ *.cpp -o filename.exe". There will be a fatal error.
browntarik commentedon Jan 4, 2025
If the issue reproduces when you just use the command line, then the issue may have to do with your shell and not our extension. I am not able to reproduce your behavior using the same compiler.
It wasn't clear based on your response if you have tried compiling with the full path. Can you confirm that doesn't work?
Did you ensure the ucrt compiler was added to your PATH environment variable?
WangShiSuiFeng24 commentedon Jan 5, 2025
No,the issue also happened in tasks.json. The shell is powershell of windows10.



I did add the ucrt compiler to the PATH environment variable. I can be sure that I also tried full path command compile. That made a fatal error.
I have also communicated with some friends on the internet. They also found there is a fatal error.
pwsh
cmd
tasks.json
SainoNamkho commentedon Jan 5, 2025
This issue is about documentation rather than cpptools itself. Maybe https://github.com/microsoft/vscode-docs/issues is the better place to report it.
https://code.visualstudio.com/docs/cpp/config-mingw recommends using gcc from msys2, which was not configured with
--enable-mingw-wildcard, thus the wildcard expansion only works in msys bash shell, not the integrated terminal wheretasks.jsonis used.However gcc from winlibs is configured with
--enable-mingw-wildcard.truongan012 commentedon Jan 6, 2025
It's disabled by msys2 as default ;(
https://www.msys2.org/news/#2024-11-03-disabling-mingw-w64-wildcard-support-by-default
I dont know how to enable it again!?
browntarik commentedon Jan 6, 2025
SainoNamkho Thank you for providing this additional context, it looks like MSYS2 decided to change their compiler behavior at the end of the year. We will update our documentation to reflect this change in behavior.
WangShiSuiFeng24 commentedon Jan 7, 2025
This issue seems to be over. Thank you all for answering my questions.