-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Language ServiceenhancementImprovement to an existing featureImprovement to an existing featurehelp wantedCan be fixed in the public (open source) repo.Can be fixed in the public (open source) repo.tasks/build/debugAn issue relating to tasks.json (e.g. build issues)An issue relating to tasks.json (e.g. build issues)
Description
Environment
- OS and version: Windows 11 23H2
- VS Code: 1.94.2 (system setup)
- C/C++ extension: v1.22.9
- OS and version of remote machine (if applicable): Ubuntu Server 24.04.1 LTS
- GDB / LLDB version: GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
Bug Summary and Steps to Reproduce
Bug Summary:
- Prepare a clean environment for C or C++ source file, which excludes
tasks.json
andlaunch.json
under.vscode
folder. - Write
hello_world.cpp
. - Generate a
tasks.json
by clickRun C/C++ File
. It should be able to run correctly. - Add
inputs
section that includes"id": "ext"
totasks.json
and append${input:ext}
to the last line inargs
. - Run the .cpp file again, and VS Code will tell you "Variable 'ext' must be defined in an 'inputs' section of the debug or task configuration."
Debugger Configurations
tasks.json:
{
"inputs": [
{
"id": "ext",
"type": "pickString",
"description": "Choose the extension",
"options": [
".app",
".exe"
],
"default": ".app"
}
],
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${cwd}/bin/${fileBasenameNoExtension}${input:ext}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Generated task by Debugger."
}
],
"version": "2.0.0"
}
launch.json:
None
Debugger Logs
VS Code window: Variable 'ext' must be defined in an 'inputs' section of the debug or task configuration.
Other Extensions
None, only C/C++
by Microsoft
installed
Additional Information
Actually, I want the tasks.json
could use different extension name by judging the platform.
I want to compile C/C++ source code on Linux and Windows by using one 'tasks.json' and no need to install other extension.
Metadata
Metadata
Assignees
Labels
Language ServiceenhancementImprovement to an existing featureImprovement to an existing featurehelp wantedCan be fixed in the public (open source) repo.Can be fixed in the public (open source) repo.tasks/build/debugAn issue relating to tasks.json (e.g. build issues)An issue relating to tasks.json (e.g. build issues)
Type
Projects
Status
No status