Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "Run without debugging" #1201

Open
HorstBaerbel opened this issue Nov 3, 2017 · 18 comments
Open

Support "Run without debugging" #1201

HorstBaerbel opened this issue Nov 3, 2017 · 18 comments

Comments

@HorstBaerbel
Copy link

@HorstBaerbel HorstBaerbel commented Nov 3, 2017

I'm running VSCode 1.17.02 on Ubuntu 16.04 x64 and cpptools 0.14.

Could you please add information about how to launch an application w/o debugging (CTRL+F5) to the VSCode C++ docs and maybe post a complete tasks.json / launch.json example here? I've read a couple of issues now and can't quite make launching work...
I use make to build my projects. I put

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "runtimeExecutable": "MYEXECUTABLE",
            "program": "${workspaceRoot}/MYOUTPUT.FILE",
            "preLaunchTask": "Make"
            }
    ]
}

into launch.json. My tasks.json looks like this:

{
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "Make",
            "type": "shell",
            "command": "make",
            "args": [""],
            "group": "build",
            "presentation": {
                "reveal": "always",
                "panel": "dedicated"
            },
            "problemMatcher": {
                "owner": "cpp",
                "fileLocation": ["relative", "${workspaceRoot}"],
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            }
        }
    ]
}

The binary file is built successfully via CTRL+SHIFT+B, but when launching via CTRL+F5 I get the message "No executable targets are available". I guess vscode does not know what output file make generates...

@agauniyal

This comment has been minimized.

Copy link

@agauniyal agauniyal commented Nov 3, 2017

Just create another task that runs builds and runs executable :|

@HorstBaerbel

This comment has been minimized.

Copy link
Author

@HorstBaerbel HorstBaerbel commented Nov 3, 2017

And connect that to CTRL+F5 through the key bindings? Might work, but how is it actually meant to be done?! What about my launch.json example? Should that work? Why not? The docs are lacking there imo... :/

@agauniyal

This comment has been minimized.

Copy link

@agauniyal agauniyal commented Nov 3, 2017

No you cannot connect it to CTRL + F5 but you'd be able to run it with CTRL+SHIFT+B if you set it default build task which I've done :)

@HorstBaerbel

This comment has been minimized.

Copy link
Author

@HorstBaerbel HorstBaerbel commented Nov 3, 2017

Thanks for the workaround, but I suspect there must be an actual solution to the problem...

@pieandcakes

This comment has been minimized.

Copy link
Collaborator

@pieandcakes pieandcakes commented Nov 6, 2017

@HorstBaerbel We haven't implemented Launch without Debugging. I'll mark this as a feature request but you may either do it as @agauniyal suggested with a batch file or from the Terminal within VSCode.

@HorstBaerbel

This comment has been minimized.

Copy link
Author

@HorstBaerbel HorstBaerbel commented Nov 7, 2017

Thanks. Will try the "build-and-run" version then for the moment...

@jcrawford

This comment has been minimized.

Copy link

@jcrawford jcrawford commented Sep 18, 2018

I would also love to see a Launch Without Debugging feature added to vscode.

@chuxubank

This comment has been minimized.

Copy link

@chuxubank chuxubank commented Sep 18, 2018

In some cases, you can use Code Runner an alternative.

@swharden

This comment has been minimized.

Copy link

@swharden swharden commented Sep 28, 2018

Isn't CTRL+F5 already the default key binding for Start (without debugging) (workbench.action.debug.run)? It seems to work for me out of the box too: F5 launches with debugging, CTRL+F5 launches without.

EDIT: In my case I don't think debugging is actually ever running properly, but at least CTRL+F5 is still "running without debugging". The only difference I see is that the call stack shows threads when I F5 but not when I CTRL+F5...

Visual Studio Code Default Key Bindings:
https://code.visualstudio.com/docs/getstarted/keybindings#_debug

My launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(Windows) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${workspaceFolder}/bin/main.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}/data/",
            "environment": [],
            "externalConsole": true,
        }
    ]
}

My tasks.json file:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "g++",
            "args": [
                "-g", "${workspaceFolder}/src/main.cpp", "-o", "${workspaceFolder}/bin/main.exe"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

My version of VS Code:

Version: 1.27.1 (system setup)
Commit: 5944e81f3c46a3938a82c701f96d7a59b074cfdc
Date: 2018-09-06T09:21:18.328Z
Electron: 2.0.7
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64
@roachsinai

This comment has been minimized.

Copy link

@roachsinai roachsinai commented Jan 18, 2019

@pieandcakes maybe a week ago, Ctrl+F5 do the same with Start without debugging. Don't why doesn't work now.

@pieandcakes

This comment has been minimized.

Copy link
Collaborator

@pieandcakes pieandcakes commented Jan 18, 2019

@roachsinai We haven't done work enable that scenario and we haven't shipped an extension update since 0.20.1 which shipped a few months back. Did you apply a VS Code update?

@roachsinai

This comment has been minimized.

Copy link

@roachsinai roachsinai commented Jan 18, 2019

Yes, update it at 2019-01-09...

@xgdgsc

This comment has been minimized.

Copy link

@xgdgsc xgdgsc commented Aug 29, 2019

Needing this launch feature.

@polyclash

This comment has been minimized.

Copy link

@polyclash polyclash commented Aug 29, 2019

We need this to run external application and capture the stdout, with no debug attached.

@pieandcakes

This comment has been minimized.

Copy link
Collaborator

@pieandcakes pieandcakes commented Aug 29, 2019

@polyclash @xgdgsc for now you can use the VS Code Terminal window to launch your application from the command line.

@polyclash

This comment has been minimized.

Copy link

@polyclash polyclash commented Aug 30, 2019

@pieandcakes yes, I use a task, the internal terminal is configured with bash(mingw64), but the terminal don't receive the stdout from the application.

@xgdgsc

This comment has been minimized.

Copy link

@xgdgsc xgdgsc commented Aug 31, 2019

But then I have to set environment variables again in the terminal, I already set those in launch configurations.

@pieandcakes pieandcakes changed the title How to launch an application without debugging? Support "Run without debugging" Oct 15, 2019
@duanyongli

This comment has been minimized.

Copy link

@duanyongli duanyongli commented Dec 26, 2019

Looking forward to this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.