Visual studio code 自动创建任务';带Visual Studio代码的s CWD文件夹 我用VisualStudio代码创建一个C++项目作为IDE和CFASE作为我的构建工具链。使用“官方”,我可以进行“树内”编译: myComplexProjectName/ include/ src/ build/ <--Created by CMake
Visual studio code 自动创建任务';带Visual Studio代码的s CWD文件夹 我用VisualStudio代码创建一个C++项目作为IDE和CFASE作为我的构建工具链。使用“官方”,我可以进行“树内”编译: myComplexProjectName/ include/ src/ build/ <--Created by CMake,visual-studio-code,cmake,Visual Studio Code,Cmake,~/Documents/builds/文件夹已存在 我正在尝试使用VisualStudio代码的任务来实现此配置。我尝试了以下任务。json配置: { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ {
~/Documents/builds/
文件夹已存在
我正在尝试使用VisualStudio代码的任务来实现此配置。我尝试了以下任务。json
配置:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build Cpp CAN Parser static library",
"type": "shell",
"command": "cmake",
"args": [
"${workspaceFolder}"
],
"options": {
"cwd": "~/Documents/builds/${workspaceFolderBasename}/"
},
"group": "build",
"presentation": {
// Reveal the output only if unrecognized errors occur.
"reveal": "silent"
},
// Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$gcc"
}
]
}
对此,我得到以下错误:
> Executing task: cmake /home/<username>/Documents/Projets/CAN/myComplexProjectName <
The terminal shell CWD "/home/<username>/Documents/Projets/CAN/myComplexProjectName/~/Documents/builds/myComplexProjectName/" does not exist
>执行任务:cmake/home//Documents/Projets/CAN/myComplexProjectName<
终端shell CWD“/home//Documents/Projets/CAN/myComplexProjectName/~/Documents/builds/myComplexProjectName/”不存在
显然,我可以自己创建输出文件夹,但是有没有办法在任务运行之前自动创建文件夹?您可以在任务上设置依赖项来构建文件夹,下面是我使用的方法
{
“版本”:“2.0.0”,
“任务”:[
{
“标签”:“测试”,
“类型”:“外壳”,
“dependsOn”:“\u makebuildfolder”,
“选择”:{
“cwd”:“${workspaceFolder}/work/test/build”
},
“命令”:“pwd”,
“问题匹配者”:[],
“集团”:{
“种类”:“测试”,
“isDefault”:正确
}
},
{
“标签”:“\u makebuildfolder”,
“类型”:“外壳”,
“命令”:“mkdir-p${workspaceFolder}/work/test/build”,
“问题匹配者”:[],
“组”:“无”
}
]
}
> Executing task: cmake /home/<username>/Documents/Projets/CAN/myComplexProjectName <
The terminal shell CWD "/home/<username>/Documents/Projets/CAN/myComplexProjectName/~/Documents/builds/myComplexProjectName/" does not exist