microsoft / microsoft/vscode-cpptools
The item "command" generated in tasks.json has something wrong
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and Version: Windows 22H2 19045.4894
- VS Code Version: 1.88.1
- C/C++ Extension Version: v1.22.9
- If using SSH remote, specify OS of remote machine: no
Bug Summary and Steps to Reproduce
Bug Summary:
After selecting debug configuration, the item "command" in tasks.json is wrong which may cause error of compiling, showing in Debug Console.
Steps to reproduce:
- Create a new directory.
- Create a new cpp file. Input the following code into the file.
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!";
return 0;
}
- Press the play button in the top right corner of the editor. Choose Run C/C++ File. Which is shown in https://code.visualstudio.com/docs/cpp/config-mingw#_run-helloworldcpp
- Choose C/C++: g++.exe build and debug active file from the list of detected compilers on your system.
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe 生成活动文件",
"command": "D:\\msys64\\ucrt64\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
],
"version": "2.0.0"
}
- Debug Console shows
ERROR: Unable to start debugging. Unexpected GDB output from command "-exec-run". During startup program exited with code 0xc0000135.
Expected behavior:
The terminal in the vscode will output "Hello,World!"
And I found the way to solve this problem:
Change "command": "D:\\msys64\\ucrt64\\bin\\g++.exe", to "command": "D:/msys64/ucrt64/bin/g++.exe",
And then everything goes well, and "Hello,World!" can be printed in the terminal.
Configuration and Logs
c_cpp_properties.json: not created
C/C++ Log Diagnostics:
-------- Diagnostics - 2024/10/20 12:01:21
Version: 1.22.9
Current Configuration:
{
"name": "Win32",
"includePath": [
"g:/MyScripts/testC++/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "gcc-x64",
"intelliSenseModeIsExplicit": true,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": false,
"mergeConfigurations": false,
"compilerPath": "",
"compilerPathIsExplicit": true,
"browse": {
"path": [
"g:/MyScripts/testC++/**",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
Modified Settings:
{
"C_Cpp.autocompleteAddParentheses": true,
"C_Cpp.errorSquiggles": "enabled",
"C_Cpp.default.intelliSenseMode": "gcc-x64",
"C_Cpp.default.compilerPath": ""
}
Additional Tracked Settings:
{
"editorTabSize": 4,
"editorInsertSpaces": true,
"editorAutoClosingBrackets": "languageDefined",
"filesEncoding": "gb2312",
"filesAssociations": {},
"filesExclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
},
"filesAutoSaveAfterDelay": true,
"editorInlayHintsEnabled": true,
"editorParameterHintsEnabled": true,
"searchExclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true
},
"workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.22.8.0
Current database path: C:\USERS\LAPTOP_LIN-UCONG\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\B8E16A9DC54146BA68D097A8B037F41F\.BROWSE.VC.DB
Translation Unit Mappings:
[ G:\MyScripts\testC++\helloworld.cpp - source TU]:
Translation Unit Configurations:
[ G:\MyScripts\testC++\helloworld.cpp ]
Process ID: 37348
Memory Usage: 60 MB
Defines:
_DEBUG
UNICODE
_UNICODE
Standard Version: c++17
IntelliSense Mode: windows-gcc-x64
Other Flags:
--g++
--gnu_version=140100
Total Memory Usage: 60 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 2
C/C++ logging
loggingLevel: Debug
loggingLevel 已更改为: Debug
LSP: (invoked) cpptools/didChangeCppProperties (id: 92)
LSP: Sending response (id: 92)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
LSP: (invoked) cpptools/didChangeActiveEditor: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
LSP: (received) cpptools/didChangeActiveEditor: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
LSP: (invoked) cpptools/didChangeActiveEditor: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
LSP: (received) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 93)
LSP: (invoked) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 93)
LSP: Sending response (id: 93)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/fileDeleted: file:///g%3A/MyScripts/testC%2B%2B/helloworld.exe
LSP: (invoked) cpptools/fileDeleted: file:///g%3A/MyScripts/testC%2B%2B/helloworld.exe
IntelliSense update scheduled and TU acquisition started for: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
更新 IntelliSense 时间(秒): 0.002
LSP: (received) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 94)
LSP: (invoked) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 94)
LSP: Sending response (id: 94)
LSP: (received) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 95)
LSP: (invoked) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 95)
LSP: Sending response (id: 95)
LSP: (received) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 96)
LSP: (invoked) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 96)
LSP: Sending response (id: 96)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 97)
LSP: (invoked) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 97)
LSP: Sending response (id: 97)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/fileCreated: file:///g%3A/MyScripts/testC%2B%2B/helloworld.exe
LSP: (invoked) cpptools/fileCreated: file:///g%3A/MyScripts/testC%2B%2B/helloworld.exe
Intellisense update pending for: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
IntelliSense update scheduled and TU acquisition started for: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
更新 IntelliSense 时间(秒): 0.002
LSP: (received) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 98)
LSP: (invoked) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 98)
LSP: Sending response (id: 98)
LSP: (received) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 99)
LSP: (invoked) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 99)
LSP: Sending response (id: 99)
LSP: (received) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 100)
LSP: (invoked) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 100)
LSP: Sending response (id: 100)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Database safe to open.
LSP: (received) cpptools/didChangeActiveEditor: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
LSP: (invoked) cpptools/didChangeActiveEditor: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 101)
LSP: (invoked) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 101)
LSP: Sending response (id: 101)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/fileDeleted: file:///g%3A/MyScripts/testC%2B%2B/helloworld.exe
LSP: (invoked) cpptools/fileDeleted: file:///g%3A/MyScripts/testC%2B%2B/helloworld.exe
Intellisense update pending for: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
LSP: (received) cpptools/fileCreated: file:///g%3A/MyScripts/testC%2B%2B/helloworld.exe
LSP: (invoked) cpptools/fileCreated: file:///g%3A/MyScripts/testC%2B%2B/helloworld.exe
IntelliSense update scheduled and TU acquisition started for: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp
更新 IntelliSense 时间(秒): 0.001
LSP: (received) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 102)
LSP: (invoked) cpptools/getCodeActions: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 102)
LSP: Sending response (id: 102)
LSP: (received) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 103)
LSP: (invoked) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 103)
LSP: Sending response (id: 103)
LSP: (received) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 104)
LSP: (invoked) cpptools/getFoldingRanges: file:///g%3A/MyScripts/testC%2B%2B/helloworld.cpp (id: 104)
LSP: Sending response (id: 104)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Database safe to open.
Other Extensions
extensions:
alefragnani.project-manager
alexcvzz.vscode-sqlite
aliasadidev.nugetpackagemanagergui
alpha4.jsonl
batisteo.vscode-django
bierner.markdown-preview-github-styles
clarkyu.vscode-sql-beautify
cschlosser.doxdocgen
cweijan.dbclient-jdbc
cweijan.vscode-mysql-client2
dotjoshjohnson.xml
eplak.vscode-uppercasesql
esbenp.prettier-vscode
formulahendry.auto-close-tag
formulahendry.auto-complete-tag
formulahendry.auto-rename-tag
fudge.auto-using
gera2ld.markmap-vscode
github.copilot
github.copilot-chat
github.vscode-pull-request-github
gruntfuggly.todo-tree
hediet.vscode-drawio
huber-baste.msgpack
jakebathman.mysql-syntax
james-yu.latex-workshop
janisdd.vscode-edit-csv
jeff-hykin.better-cpp-syntax
k--kato.docomment
kiteco.kite
kreativ-software.csharpextensions
mechatroner.rainbow-csv
mhutchie.git-graph
ms-azuretools.vscode-docker
ms-ceintl.vscode-language-pack-zh-hans
ms-dotnettools.csharp
ms-dotnettools.vscode-dotnet-runtime
ms-python.debugpy
ms-python.isort
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
ms-toolsai.vscode-jupyter-cell-tags
ms-toolsai.vscode-jupyter-powertoys
ms-toolsai.vscode-jupyter-slideshow
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode.cmake-tools
ms-vscode.cpptools
ms-vscode.cpptools-extension-pack
ms-vscode.cpptools-themes
ms-vscode.remote-explorer
mtxr.sqltools
mtxr.sqltools-driver-mysql
negokaz.live-server-preview
nopeslide.vscode-drawio-plugin-mermaid
nopeslide.vscode-drawio-plugin-rtl
nopeslide.vscode-drawio-plugin-wavedrom
oderwat.indent-rainbow
redhat.java
redhat.vscode-community-server-connector
redhat.vscode-rsp-ui
redhat.vscode-xml
ritwickdey.liveserver
sharzyl.cjk-word-handler
shd101wyy.markdown-preview-enhanced
shengchen.vscode-checkstyle
sterben.fpga-support
tomoki1207.pdf
twxs.cmake
visualstudioexptteam.intellicode-api-usage-examples
visualstudioexptteam.vscodeintellicode
vmware.vscode-boot-dev-pack
vmware.vscode-spring-boot
vsce-toolroom.vscode-beautify
vscjava.vscode-gradle
vscjava.vscode-java-debug
vscjava.vscode-java-dependency
vscjava.vscode-java-pack
vscjava.vscode-java-test
vscjava.vscode-maven
vscjava.vscode-spring-boot-dashboard
vscjava.vscode-spring-initializr
vscodevim.vim
vue.volar
w88975.code-translate
warren-buckley.iis-express
yzhang.markdown-all-in-one
zainchen.json
Additional context
Before:
After:
tasks.json
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the documented MinGW flow and inspect the generated tasks.json command for the Windows path shown in the report. Compare it with the forward-slash workaround; done means the generated task starts debugging successfully and prints Hello, World! in the terminal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100