Summary:
While in tasks.json the destination argument for g++ is clearly "${fileDirname}\\${fileBasenameNoExtension}.exe"
, it decides to build in "${workplaceFolder}\\${fileBasenameNoExtension}.exe"
...
Example case:
folder structure:
in tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\dev\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": { "cwd": "C:\\dev\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin" },
"problemMatcher": [ "$gcc" ],
"group": { "kind": "build", "isDefault": true },
"detail": "compiler: C:\\dev\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe"
}
]
}
in example.cpp:
#include <iostream>
int main()
{
std::cout << "Why do i not get compiled in "cpp/folder1/folder2"?";
return 0;
}
In vscode with cpp folder opened as workplace: Pressing Ctrl+Shift+B to build now causes g++ to build the example.exe at cpp/example.exe.
Known issue and one that got fixed yesterday. Have to wait for the next C/c++ vscode extension update: