当前步骤:构建Tasks.json文件

时间:2018-09-14 02:53:48

标签: c++ powershell visual-studio-code command-prompt git-bash

在遵循此https://www.youtube.com/watch?v=DIw02CaEusY时出现以下错误,有人可以帮助我弄清楚我的混乱之处。

    {
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "g++",
            "args": ["-g", "main.cpp"],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
  

执行任务:g ++ -g main.cpp << / p>      

'g ++'不被识别为内部或外部命令,可操作   程序或批处理文件。终端进程以退出代码终止:   1

     

终端将被任务重用,按任意键将其关闭。

1 个答案:

答案 0 :(得分:1)

例如参见Microsoft/vscode-cpptools/issue 1329

  

我已经解决了这个问题。我不确定VS Code为什么不选择环境路径或使用的路径,因为它会以某种方式选择我的CMake目录,而不是我的MinGW目录。我可以通过在命令中使用g ++的完整路径来解决此问题

     

将命令属性从“ g++”更改为“ C:/MinGW/bin/g++”。