I am compiling below code with GCC-12 compiler on Ubuntu 22.04 LTS. I have 2 different versions of GCC installed on my machine 11 and 12.
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
}
This is my tasks.json file
{
"tasks": [
{
"type": "cppbuild",
"label": "Build with GCC 11",
"command": "/usr/bin/gcc-11",
"args": [
"-fdiagnostics-color=always",
"-g",
"-L/usr/lib/x86_64-linux-gnu/libstdc++.so.6",
"-lstdc++",
"-std=c++17",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
and I am getting the following error
Executing task: Build with GCC 12
Starting build... /usr/bin/gcc-12 -fdiagnostics-color=always -g
-L/usr/lib/x86_64-linux-gnu/libstdc++.so.6 -lstdc++ -std=c++20 /home/pratham/Downloads/C++/hello.cpp -o
/home/pratham/Downloads/C++/hello
gcc-12: fatal error: cannot execute ‘cc1plus’: execvp: No such file or
directory compilation terminated.
Build finished with error(s).
- The terminal process failed to launch (exit code: -1).
- Terminal will be reused by tasks, press any key to close it.