[英]VScode Terminal giving output: 'g++' is not recognized as an internal or external command, operable program or batch file
I first installed the Mingw from https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/ and downloaded all the packages and set C:\\MinGW\\bin as a new path in my Environmental System Variables.我首先从https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/安装了 Mingw 并下载了所有软件包并将 C:\\MinGW\\bin 设置为我的环境中的新路径系统变量。 I open my command prompt and type "g++ --version" which gives me the output "g++ (MinGW.org GCC-8.2.0-5) 8.2.0" So I believe this means so far I'm follow the correct path.
我打开我的命令提示符并输入“g++ --version”,它给了我输出“g++(MinGW.org GCC-8.2.0-5)8.2.0”所以我相信这意味着到目前为止我遵循正确的路径.
My problem arises while I'm in VSCode trying to compile a basic hello world file.当我在 VSCode 中尝试编译基本的 hello world 文件时出现了我的问题。 In the terminal I input "g++ main.cpp" however this gets me the output "'g++' is not recognized as an internal or external command, operable program or batch file."
在终端中,我输入了“g++ main.cpp”,但是这让我得到了输出“'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件。” Does this have to do with how one of my .json files are set up?
这与我的 .json 文件之一的设置方式有关吗? I've included the following c_cpp_poperties, launch, and task code.
我已经包含了以下 c_cpp_poperties、启动和任务代码。
Thank you.谢谢你。
c_cpp_properties.json: c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\MinGW\\bin\\gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4}
launch.json:启动.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
},
]}
task.json:任务.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "build hello world",
"type": "shell",
"command": "C:/MinGW/bin/g++",
"args": [
"-g",
"-o",
"helloworld",
"helloworld.cpp"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]}
Replace代替
"compilerPath": "C:\\MinGW\\bin\\gcc.exe",
With和
"compilerPath": "C:\\MinGW\\bin\\g++.exe",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.