I've followed the instructions here to setup VSCode with C++ on Windows 10 with MingGW https://code.visualstudio.com/docs/languages/cpp and I've followed the instructions at this link to create my task to build all .cpp files in the current folder VS Code will not build c++ programs with multiple .ccp source files
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\msys64\\mingw64\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${fileDirname}\\**.cpp",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
However, when attempting to build, I'm getting this error:
Starting build...
C:\msys64\mingw64\bin\g++.exe -fdiagnostics-color=always -g "C:\Users\user\Documents\CPP_test\.vscode\**.cpp" -o "C:\Users\user\Documents\CPP_test\.vscode\tasks.exe"
cc1plus.exe: fatal error: C:\Users\user\Documents\CPP_test\.vscode\**.cpp: Invalid argument
compilation terminated.
I've tried replacing the argument with \\*.cpp
, /**.cpp
, /*/*.cpp
but none of it worked. For some reason it refuses to explode the * wildcard.
How can I make VS Code build all CPP files in the folder?