【问题标题】:VSCode Terminal cannot find ‘make’ 'g++', but the standard Windows Console canVSCode 终端找不到‘make’‘g++’,但标准的 Windows 控制台可以
【发布时间】:2021-02-28 00:17:15
【问题描述】:

我可以在标准 Windows 控制台中运行“make”或“g++”,但无法在 VSCode 终端中运行它们。

我尝试使用 VSCode 终端运行“make”或“g++”,但找不到这些命令:

C:\CEngineering\VSCpp> make --version
'make' is not recognized as an internal or external command,
operable program or batch file.

C:\CEngineering\VSCpp> g++ --version
'g++' is not recognized as an internal or external command,
operable program or batch file.

但是,标准 Windows 控制台运行良好

C:\Users\cb> make --version
mingw-get version 0.6.3-pre-20170905-1
Copyright (C) 2009-2013, MinGW.org Project

This is free software; see the product documentation, or source code,
for copying and redistribution conditions.  There is NO WARRANTY; not
even an implied WARRANTY OF MERCHANTABILITY, nor of FITNESS FOR ANY
PARTICULAR PURPOSE.


C:\Users\cb> g++ --version
g++ (MinGW.org GCC Build-2) 9.2.0
Copyright (c) 2019 Free Software Foundation, Inc.

我不知道为什么我不能在 VSCode 终端中运行。我检查了 VSCode 终端设置,它们是 same 程序(C:\WINDOWS\system32\cmd.exe),但结果不同......奇怪

【问题讨论】:

  • 如果您的 PATH 中有正确的内容,那么两者都应该可以找到它。
  • 安装mingw并更新PATH后是否重启过VSCode?​​span>
  • 是的,我重新启动了,但它仍然不起作用。也许问题在于 VSCode 正在使用一些不同的设置启动其终端。

标签: c++ visual-studio-code g++ mingw32


【解决方案1】:

好的,我想我找到了一些解决方案...

请尝试:

解决方案 1:将 VS Code 重新安装到 没有 空白的路径。我把它发给C:\VSCode

解决方案 2:设置 VS 代码属性

  • √ 以管理员身份运行此程序

祝你好运。

【讨论】:

    【解决方案2】:

    从标准 Windows 控制台打开 VSCode(只需调用 code),当您这样做时,环境变量将被传递给 VSCode。

    【讨论】:

      猜你喜欢
      • 2018-05-19
      • 2020-05-06
      • 2020-12-07
      • 2022-11-21
      • 1970-01-01
      • 1970-01-01
      • 2022-11-12
      • 2022-01-25
      相关资源
      最近更新 更多