C++ 'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38652211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 14:46:49  来源:igfitidea点击:

'g++' is not recognized as an internal or external command, operable program or batch file

c++

提问by Rakesh Dagdi

#include<iostream>
using namespace std;
int main()
{
    cout<<"hi"<<endl;   
    return 0;
}

I am using Sublime text 3, and I am getting this error:

我正在使用 Sublime text 3,但出现此错误:

error- 'g++' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.0s]

错误 - 'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件。【0.0s完成】

回答by msc

回答by Web for Beginner

For me it's easily fix by two steps: as below 1. set environment variable

对我来说,它很容易通过两个步骤修复:如下 1. 设置环境变量

C:/MinGW/bin
  1. Paste the following code in the "launch.json"
  1. 将以下代码粘贴到“launch.json”中
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C++ Compiler",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "C:/MinGW/bin",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true
        },
    ]
}