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

Launch.json isn't syncronized by file name. #13222

Open
Watynecc opened this issue Feb 1, 2025 · 2 comments
Open

Launch.json isn't syncronized by file name. #13222

Watynecc opened this issue Feb 1, 2025 · 2 comments
Labels
Feature Request tasks/build/debug An issue relating to tasks.json (e.g. build issues)

Comments

@Watynecc
Copy link

Watynecc commented Feb 1, 2025

Environment

  • OS and version: Windows 10
  • VS Code: 1.96.4
  • C/C++ extension: Lastest
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: using MSCV ?

Bug Summary and Steps to Reproduce

Bug Summary:

Launch.json isn't sync with tasks.json. It mean when debugging a C or C++ file you get a error "launch program does not exist"

I remplaced the default program line "program": "enter program name, for example ${workspaceFolder}/a.exe" by
"program": "${fileBasenameNoExtension}.exe"

And now it works... Why it isn't by default ? I though I f***ed up my compiler installation ;-;

Debugger Configurations

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": "(Windows) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "console": "externalTerminal"
        }

    ]
}

Tasks.json :
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: cl.exe build active file",
            "command": "cl.exe",
            "args": [
                "/Zi",
                "/EHsc",
                "/nologo",
                "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
                "${file}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$msCompile"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

Debugger Logs

"launch program " does not exist"

Other Extensions

No response

Additional Information

The error is present also in GCC configuration

@Watynecc
Copy link
Author

Watynecc commented Feb 1, 2025

I wonder if we could premodify the "program" line for easier setup. Launching only one file shoudn't be that tricky

@bobbrow
Copy link
Member

bobbrow commented Feb 4, 2025

How are you creating your launch configuration? Are you using the "Add Configuration..." button in the editor? Improvements to this flow are on our radar, but we haven't had the chance to implement anything yet.

However, it looks like you are doing something similar to a feature that we already have: Build and Debug Active File. If you click the gear icon in the upper right side of the editor while your source file is active, the extension will generate both the task and the launch configuration for you in a way similar to what you describe.

Image

Image

@bobbrow bobbrow added Feature Request tasks/build/debug An issue relating to tasks.json (e.g. build issues) labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request tasks/build/debug An issue relating to tasks.json (e.g. build issues)
Projects
None yet
Development

No branches or pull requests

2 participants