How to run D code program in visual studio? Ubuntu 18.04 - d

Althougt I had installed dub,dmd. I can run test.d in terminal.But I can't run file test.d in visual studio code.
Maybe should change launch.son file?

{
// 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": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/mct.d",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Launch.json file

"program": "${workspaceRoot}/mct.d"
This should be a path to the executable, not the source file. Try:
"program": "${workspaceRoot}/mct.exe"

Related

The preLaunch 'C/C++:gcc.exe build active file' terminated with exit code -1

When ever I debug my code in Visual Studio Code I get
The preLaunch 'C/C++:gcc.exe build active file' terminated with exit code -1
I built my file using cpp.exe,
here is the launch.json file :
{
// 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": [
{
"name": "gcc.exe - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "C://code//program.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc.exe build active file"
}
]
}

Visual Studio Code C++ debugger doesn't launch

Try to launch a c++ project, chose gdb launcher
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": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "enter program name, for example ${workspaceFolder}/a.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/path/to/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

Debugging in VS Code in Ubuntu

so i have a problem with debugging a program in VS Code in Ubuntu. When i try that i get this message launch:program 'enter program name, for example /home/daniel/Desktop/OOP/Test/a.out'does not exist and i have an option to see the launch.json file. So any ideas what is the problem? And whats wrong?
Here is the launch.json file:
{
// 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": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "enter program name, for example ${workspaceFolder}/a.out",
"args": [],
"stopAt`enter code here`Entry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Try changing the line
"program": "enter program name, for example ${workspaceFolder}/a.out",
to this
"program": "/home/daniel/Desktop/OOP/Test/a.out",

gdb on mojave works in terminal but not in vs code

After those tricks about codesigning, I've got to make gdb run on my mac (10.14.6), but only in terminal, and it gives no response in vs code.
Everything works just fine in terminal, like setting breakpoints, printing variables and running the executables, but it gets stuck in vs code, and nothing shows up in the variable and call stack sections.
Here's my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/local/bin/gdb",
/* "setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
], */
"preLaunchTask": "Build"
}
]
}
vs code
terminal

Build Project Without Debugging or Running in VS Code

I'm using Visual Studio Code to compile C and C ++ files but I just want to build the project without doing other actions, can that be in VS Code? Or will it always try to run the project? Here is my tasks.json file:
{
// 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": [
{
"name": "vde.exe build",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "\\usr\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "vde.exe build active file"
}
]
}