I'm using Visual Studio Code for C++ coding and I'm using g++.exe for compiling with MinGW for building.It builds and runs my C++ code properly when I do not use Ctrl + Shift + B. (F1 -> C/C++ : Build and Debug Active file-> g++.exe
)However, once I use Ctrl + Shift + B, it goes wrong. The terminal says the build has been succeeded, but it does not run the created .exe file and keeps silence saying
Terminal will be reused by tasks, press any key to close it.
When I rebuild it by F1 -> C/C++ : Build and Debug Active file-> g++.exe
it works.
What is wrong with it?Here is my tasks.json
file
{"tasks": [ {"type": "cppbuild","label": "C/C++: gcc.exe アクティブなファイルのビルド","command": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gcc.exe","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe" ],"options": {"cwd": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin" },"problemMatcher": ["$gcc" ],"group": "build","detail": "デバッガーによって生成されたタスク。" }, {"type": "cppbuild","label": "C/C++: gcc.exe アクティブなファイルのビルド ver(1)","command": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gcc.exe","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe" ],"options": {"cwd": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin" },"problemMatcher": ["$gcc" ],"group": "build","detail": "デバッガーによって生成されたタスク。" }, {"type": "cppbuild","label": "C/C++: g++.exe アクティブなファイルのビルド","command": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe" ],"options": {"cwd": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin" },"problemMatcher": ["$gcc" ],"group": "build","detail": "デバッガーによって生成されたタスク。" }, {"type": "cppbuild","label": "C/C++: g++.exe アクティブなファイルのビルド ver(1)","command": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe" ],"options": {"cwd": "${workspaceFolder}" },"problemMatcher": ["$gcc" ],"group": "build","detail": "デバッガーによって生成されたタスク。" }, {"type": "cppbuild","label": "C/C++: g++.exe アクティブなファイルのビルド ver(2)","command": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe" ],"options": {"cwd": "${workspaceFolder}" },"problemMatcher": ["$gcc" ],"group": "build","detail": "デバッガーによって生成されたタスク。" }, {"type": "cppbuild","label": "C/C++: g++.exe アクティブなファイルのビルド","command": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe" ],"options": {"cwd": "${workspaceFolder}" },"problemMatcher": ["$gcc" ],"group": "build","detail": "コンパイラ: C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe" }, {"type": "cppbuild","label": "C/C++: g++.exe アクティブなファイルのビルド","command": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe" ],"options": {"cwd": "${workspaceFolder}" },"problemMatcher": ["$gcc" ],"group": "build","detail": "コンパイラ: C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe" }, {"type": "cppbuild","label": "C/C++: g++.exe アクティブなファイルのビルド ver(3)","command": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe" ],"options": {"cwd": "${workspaceFolder}" },"problemMatcher": ["$gcc" ],"group": "build","detail": "デバッガーによって生成されたタスク。" }, {"type": "cppbuild","label": "C/C++: g++.exe アクティブなファイルのビルド ver(4)","command": "C:\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe" ],"options": {"cwd": "${workspaceFolder}" },"problemMatcher": ["$gcc" ],"group": {"kind": "build","isDefault": true },"detail": "デバッガーによって生成されたタスク。" } ],"version": "2.0.0"}