【发布时间】:2019-06-17 19:55:04
【问题描述】:
我已经配置了我的 task.json 和 c_cpp_properties.json 以便我可以编译我的 main.cpp 程序。为了继续,我必须按
Ctrl + Shift + B
只要我这样做,就会弹出一个终端并改变我的错误:
Executing task in folder C++: C:\MinGW\bin\g++.exe -g main.cpp -o c:\Users\Me\Desktop\C++\.vscode\tasks.exe <
/bin/bash: C:MinGWbing++.exe: command not found
The terminal process terminated with exit code: 127
Terminal will be reused by tasks, press any key to close it.
我不知道为什么会发生这种情况,因为我已经检查了 MinGW 是否以正确的 PATH 安装在我的计算机中。为了确保我这样做,我在终端中输入了以下内容:
g++ --version
g++ (MinGW.org GCC-8.2.0-3) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
我也根据这个figure检查了路径
与我的唯一最接近的问题是在这个Github 链接中。我也已经尝试使用this 线程更改下面代码中显示的文件目录,但我仍然遇到此错误。
这是我的 .vscode 文件中的 JSON 文件:
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-g",
"main.cpp",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
}
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17134.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceRoot}",
"C:\\MinGW\\lib\\gcc\\mingw32\\8.2.0\\include\\c++"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
我应该期望在编译后看到一个“.exe”,但由于错误而我看不到。
【问题讨论】: