【问题标题】:Unable to build and run c++ code in visual studio code无法在 Visual Studio 代码中构建和运行 C++ 代码
【发布时间】:2020-05-23 21:05:01
【问题描述】:

我已经为 mingw 设置了正确的路径,并且能够使用 vscode 中的终端成功编译我的代码。但是当我按 ctrl+shift+b 构建时,我的终端中出现以下错误

Executing task: C:\MinGW\bin\g++.exe -g 'c:\Users\Ansh Kapoor\Desktop\cpp\main.cpp' -o 'c:\Users\Ansh 
Kapoor\Desktop\cpp\main.exe'<
/usr/bin/bash: C:MinGWbing++.exe: command not found
The terminal process terminated with exit code: 127

而当我编写时,相同的代码已成功执行

    g++ main.cpp -o 'main.exe'

现在我检查了路径和环境变量,所有这些都是正确的。

【问题讨论】:

  • 试试C:\\MinGW\\bin\\g++.exeC:/MinGW/bin/g++.exe
  • 是的,错误信息中缺少的反斜杠应该是线索

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


【解决方案1】:

找不到正确路径的错误是因为使用 git bash 作为终端而不是 windows powershell 或 cmd。

【讨论】:

    猜你喜欢
    • 2020-06-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-25
    • 1970-01-01
    • 2021-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多