Я пытаюсь использовать функцию отладки из кода Visual Studio 1.30.1 на Ubuntu 18.04.1 в качестве расширения отладки. Я использую C / C ++ 0.20.1 из ms-vscode.cpptools.
Я скомпилировал файл main.c с помощью gcc -Wall -g main.c -o main
Это код main.c
#include <stdio.h>
int main ()
{
printf("Hello World\n");
}
Конфигурация launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink /?linkid=830387
"version": "0.2.0",
"configurations": [
{
// for Linux
"name": "gdb C",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
//"preLaunchTask": "build cunit",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Когда я запускаю отладчик, я получаю
Stopping due to fatal error: NullReferenceException: Object reference not set to an instance of an object
Версия кода Visual Studio:
Версия: 1.30.1
Совершить: dea8705087adb1b5e5ae1d9123278e178656186a
Дата: 2018-12-18T18: 07: 32.870Z
Электрон: 2.0.12
Хром: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
ОС: Linux x64 4.15.0-43-generic
tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build C",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
//"command":"gcc -g main.c -std=c11 -Werror -Wall -lm"
"command":"gcc -Wall -g main.c"
}
]
}