Reputation: 45
I am trying to use the VSCode run and debugger in Linux Ubuntu but when I run or Debug it gives this error:
launch: program 'enter program name, for example /home/user/Documents/Drexel/a.out' does not exist Cancel or open 'launch.json'
But a.out exists:
VSCoe terminal:
user:~/Documents/Drexel$ g++ helloworld.c
user:~/Documents/Drexel$ ./a.out
Hello C++ World from VS Code and the C++ extension!
user:~/Documents/Drexel$ gcc ccadd.c
user:~/Documents/Drexel$ ./a.out
Usage: ccadd maker model year cpu id desc
So the a.out seems to work that isn't the problem it could be:
Intellisense built these .json incorrectly
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.out",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
//"cwd": "/usr/bin",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
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",
"type": "shell",
"command": "msbuild",
"args": [
// Ask msbuild to generate full paths for file names.
"/property:GenerateFullPaths=true",
"/t:build",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
"/consoleloggerparameters:NoSummary"
],
"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": "$msCompile"
}
]
}
c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
},
{
"name": "gcc",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
Upvotes: 0
Views: 2071
Reputation: 45
Change:
"program": "enter program name, for example ${workspaceFolder}/a.out",
To
"program": "${workspaceFolder}/a.out",
Upvotes: 1