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
'g++' is not recognized as an internal or external command, operable program or batch file
提问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
Try to set g++
to your system path.
尝试设置g++
为您的系统路径。
You can refer to this: http://stephencoakley.com/2015/01/21/guide-setting-up-a-simple-c-development-environment-on-windows
你可以参考这个:http: //stephencoakley.com/2015/01/21/guide-setting-up-a-simple-c-development-environment-on-windows
回答by Web for Beginner
For me it's easily fix by two steps: as below 1. set environment variable
对我来说,它很容易通过两个步骤修复:如下 1. 设置环境变量
C:/MinGW/bin
- Paste the following code in the "launch.json"
- 将以下代码粘贴到“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
},
]
}