简体   繁体   English

VScode 终端给出输出:'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件

[英]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.

相关问题 'g++' 不是内部或外部命令、可运行程序或批处理文件 - 'g++' is not recognized as an internal or external command, operable program or batch file 'g++' 不是内部或外部命令、可运行程序或批处理文件。 - 'g++' is not recognized as an internal or external command, operable program or batch file. 'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件。 即使正确安装了 gcc - 'g++' is not recognized as an internal or external command, operable program or batch file. even though gcc is installed correctly 如何在 Atom 中编译和运行程序? 我得到这个“不被识别为内部或外部命令、可运行程序或批处理文件”。 - How to compile and run a program in Atom? I get this "is not recognized as an internal or external command, operable program or batch file." exe文件未被识别为C ++中的内部或外部命令,可操作程序或批处理文件 - exe file is not recognized as an internal or external command, operable program or batch file in C++ 在附加的控制台中输入文本时,如何避免“未被识别为内部或外部命令,可操作程序或批处理文件”? - How to avoid “is not recognized as an internal or external command, operable program or batch file” when entering text in attached console? Windows 10 - 'make' 未被识别为内部或外部命令、可运行程序或批处理文件 - Windows 10 - 'make' is not recognized as an internal or external command, operable program or batch file 'mblctr' 不是内部或外部命令,也不是可运行的程序或批处理文件。如何解决这个问题? - 'mblctr' is not recognized as an internal or external command, operable program or batch file.How to fix this? ./a.out 结果 '.' 不是内部或外部命令、可运行的程序或批处理文件 - ./a.out results '.' is not recognized as an internal or external command, operable program or batch file 无法将c ++ win32控制台应用程序识别为内部或外部命令可操作程序或批处理文件 - c++ win32 console application is not recognized as an internal or external command operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM