0

According to the following link, I installed and execute the sample CPP program. But I have an error:

https://code.visualstudio.com/docs/cpp/config-mingw

Tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

PS F:\VS_Code\projects\cpp\helloworld> helloworld.exe helloworld.exe : The term 'helloworld.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • helloworld.exe
  •   + CategoryInfo          : ObjectNotFound: (helloworld.exe:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    

Suggestion [3,General]: The command helloworld.exe was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\helloworld.exe". See "get-help about_Command_Precedence" for more details

enter image description here

2 Answers 2

1

I was just wondering about this! type ".\helloworld.exe" you will see the "HelloWorld" because you are working in PowerShell. If you are in Command Prompt, type "helloworld.exe".

Sign up to request clarification or add additional context in comments.

Comments

0

Type .\helloworld.exe if you are in PowerShell.

1 Comment

It is the same as accepted answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.