${relativeFileDirname} 不会在 tasks.json 中解析



这是我的tasks.json供参考:

{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "build active file with debug",
"command": "/usr/bin/g++",
"args": [
"${file}",
"-o",
"${workspaceFolder}/out/${relativeFileDirname}.out",
"-g"
],
"problemMatcher": ["$gcc"],
"group": "build",
"detail": "compiler: /usr/bin/g++"
},
]
}

以下是演示输出的视频:https://i.stack.imgur.com/RHXvr.jpg

在视频中,我正在编译一个文件12-how-to-debug-effectively/main.cpp,根据我的tasks.json,输出文件应该是out/12-how-to-debug-effectively.out,但由于某种原因,变量替换不起作用,我得到了out/.out

有什么我可能出错的地方吗?

cppbuild不是type参数的有效值。

VSC文档站点上的所有示例都使用"type": "shell"

当使用"type": "shell"时,我可以看到要执行的命令,并且变量填写正确。(我使用了一个1字的子目录mysite(

使用"type": "cppbuild",我看不出执行了哪个命令。

最新更新