Vscode-cpptools: Run-> add configuration ->C++ (GDB/LLDB) "Cannot read property 'includes' of undefined

Created on 18 Nov 2020  路  12Comments  路  Source: microsoft/vscode-cpptools

Type: Debugger

Describe the bug

  • OS and Version:
  • VS Code Version:
  • C/C++ Extension Version:
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

To Reproduce
Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Additional context
If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your launch.json
Add any other context about the problem here including log or error messages in your Debug Console or Output windows.
image
image

Language Service builtasks fixed (release pending) quick fix regression

Most helpful comment

I changed the "type" in task.jason from "shell" to "cppbuild", now it works, thanks a lot for your help @sean-mcmanus, attached is my task.jason file.

{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Generated task by Debugger"
}
],
"version": "2.0.0"
}

All 12 comments

If you access Help->Toggle Developer Tools->Console do you see a call stack for that error?

You're using 1.1.2 of the extension, right?

Also, any other repro details?

I second this.
Using 1.1.2.

image

@gegogi Thanks for the info -- you are correct.

It appears to be line https://github.com/microsoft/vscode-cpptools/blob/release/Extension/src/Debugger/configurationProvider.ts#L158 (or the similar one). I repro the bug when I delete the "command" field in my tasks.json. Does your tasks.json not have a "command" field for some reason? Do you have a C/C++ compiler installed?

This is my tasks.json and it has command field.
Compiler (VC Toolset) is also installed and I can compile.
Is there any way that I can debug against my local installation of cpptools?

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "Build",
            "command": "cl.exe",
            "args": [
                "/I",
                "${workspaceFolder}\\..\\sqlite",
                "/Zi",
                "/EHsc",
                "/Fe:",
                "${fileDirname}\\${workspaceFolderBasename}.exe",
                "main.c",
                "..\\sqlite\\sqlite3.lib"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$msCompile"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: cl.exe"
        }
    ],
}

That's okay -- I figured it out (see https://github.com/microsoft/vscode-cpptools/pull/6539). A workaround is to change the task's "type" from "shell" to "cppbuild".

When I use "cppbuild", it does not expand variable like ${workspaceFolderBasename} in compiling.
That's why I use "shell".

@gegogi Thanks for letting us know -- fixed with https://github.com/microsoft/vscode-cpptools/pull/6539/commits/ad9f80789efddbc4a0691a63d626ee7a1c8fbc08 . Unfortunately the workaround mentioned previously doesn't work in that case.

Well, a potential workaround is to use 1.0.1 (until we can get a 1.1.3 or 1.2.0-insiders released).

I changed the "type" in task.jason from "shell" to "cppbuild", now it works, thanks a lot for your help @sean-mcmanus, attached is my task.jason file.

{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Generated task by Debugger"
}
],
"version": "2.0.0"
}

Was this page helpful?
0 / 5 - 0 ratings