IgnisDa
IgnisDa

Reputation: 176

${relativeFileDirname} doesn't resolve in tasks.json

Here's my tasks.json for reference:

{
  "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++"
    },
  ]
}

Here's a video to demonstrate the output: https://i.sstatic.net/RHXvr.jpg

In the video I am compiling a file 12-how-to-debug-effectively/main.cpp, and according to my tasks.json, the output file should be out/12-how-to-debug-effectively.out, but for some reason the variable substitution doesn't work and I instead get out/.out.

Any pointers where I might be going wrong?

Upvotes: 0

Views: 408

Answers (1)

rioV8
rioV8

Reputation: 28783

cppbuild is not a valid value for the type argument.

All the examples on the VSC doc site use "type": "shell"

When using "type": "shell" I can see the command to be executed and the variables are filled in correct. (I used a 1 word subdirectory mysite)

Using "type": "cppbuild" I can't see which command is executed.

Upvotes: 1

Related Questions