Error while building task in c++ “Invalid arugemt”


This Content is from Stack Overflow. Question asked by mahir

I am trying to learn c++ debugging . I am configuring tasks.json according to tutorial from udemy . I really need your help.
When I am running the code , it is giving expected output . but when I am building the task it is giving me error . I configure it correctly according to tutorial and he is getting “Task build successfull”

C++ code

using namespace std;
int main(){
    cout<<"Hello from main";
    return 0;


    "version": "2.0.0",
    "tasks": [
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:/MinGW/bin/g++.exe",
            "args": [
                "-Wall",// is used to tell to produce all the warning
                "-std=c++17", // is used to tell to complie using c++17 complier
                "${fileDirname}\*.cpp",// is used to tell the build to compile all the file in the folder
            "options": {
                "cwd": "C:/MinGW/bin"
            "problemMatcher": [
            "group": {
                "kind": "build",
                "isDefault": true
            "detail": "compiler: C:/MinGW/bin/g++.exe"


    C:UsersmahirOneDriveDocumentsC++ debugging Udemyproject 1main.exe"
g++.exe: error: C:UsersmahirOneDriveDocumentsC++ debugging Udemyproject 1*.cpp: Invalid argument
g++.exe: fatal error: no input files
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. 


Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?