gpt4 book ai didi

c++ - ${workspaceFolder}\\*.cpp 显然未被识别为 vscode tasks.json 中的有效路径

转载 作者:行者123 更新时间:2023-12-05 06:18:14 28 4
gpt4 key购买 nike

在我的工作区文件夹中按 ctrl+shift+b 时,我得到 The terminal process terminated with exit code 1。这似乎意味着路径不正确。然而,我在这里遵循 Microsoft 的说明:

https://code.visualstudio.com/docs/cpp/config-mingw#_modifying-tasksjson

我还检查了 stackoverflow,这绝对有效。当我将 *.cpp 替换为 main.cpp 时,它编译没有问题。我现在只有一个文件,但将来肯定会有更多。

我使用的是 vscode 1.44.2,g++ 9.3.0。

{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "g++.exe build active file",
"command": "D:\\cygwin64\\bin\\g++.exe",
"args": [
"-g",
"${workspaceFolder}\\*.cpp",
"-o",
"${workspaceFolder}\\BreadShopPro.exe"
],
"options": {
"cwd": "D:\\cygwin64\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

My workspace folder

最佳答案

您是否在目录中任何文件夹的名称之间放置了空格?放置一个空格会使目录无效(即“我的项目”将不会被识别,但“我的项目”会)。似乎这可能是问题所在。我遇到了同样的问题,这解决了我的问题。

关于c++ - ${workspaceFolder}\\*.cpp 显然未被识别为 vscode tasks.json 中的有效路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61328894/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com