获取:'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件 [英] Getting: 'g++' is not recognized as an internal or external command, operable program or batch file

查看:45
本文介绍了获取:'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试在 Visual Studio 代码上运行 C++ 时,它输出的g++"未被识别为内部或外部命令、可运行的程序或批处理文件.我试过多次重置我的电脑.我还为 C++ 编译器获得了 MinGW.我曾尝试在网上和此处寻找解决方案,但找不到任何解决方案.

Whenever I try to run C++ on Visual Studio code it outputs 'g++' is not recognized as an internal or external command, operable program or batch file. I've tried resetting my computer many times. I also got MinGW for the C++ complier. I've tried looking for solution's on the web and on here but could not find any.

推荐答案

如果设置正确,VSCode 通常会为您创建可用的配置文件.以下内容基于Windows 10,其他平台更简单.

If set up properly, VSCode will usually create available profiles for you. The following content is based on Windows 10, and it's simpler on other platforms.

  1. 安装 MinGWMinGW-w64.确保 bin 文件夹在 PATH
  2. 在 VSCode 文件夹/工作区中,删除或备份 .vscode 中的所有配置文件.如果 .vscode 不存在,则创建一个空的 .vscode.
  3. 打开一个示例文件,例如 hello.c,运行它并按照指南进行操作:C++(GDB/LLDB) >>> gcc.exe....
  1. Install MinGW or MinGW-w64. Make sure the bin folder is in PATH
  2. In VSCode Folder/Workspace, delete or backup all profiles in .vscode. If .vscode is not existing, create a empty .vscode.
  3. Open a example file such as hello.c, run it and follow the guides: C++(GDB/LLDB) >>> gcc.exe....

如果一切顺利,VSCode 将正确创建 luch.jsontasks.json.然后您现在可以运行或调试您的 c/cpp 文件.

If all goes well, VSCode will cerate lauch.json and tasks.json correctly. Then you can run or debug your c/cpp file now.

这篇关于获取:'g++' 不是内部或外部命令,也不是可运行的程序或批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆