microsoft / microsoft/vscode-cpptools

It is not debugging c++ files but it works fine with c files

Aperta
#7,981 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

debugger
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Bug type: Debugger

Describe the bug

  • OS and Version: windows 10
  • VS Code Version: latest
  • C/C++ Extension Version: latest
  • Other extensions you installed (and if the issue persists after disabling them): code runner by jun han. and yes the issue is still there after disabling it.
  • A clear and concise description of what the bug is. So the debugger in vs code is not allowing me to debug c++ files but i can debug c files, so i dont know what is the problem with it. I was able to debug c++ a few days ago but now i am not allowed to do so. Whenever i try to debug this message comes up : "the prelaunch task 'C/C++: g++.exe build active file' terminated with exit code -1".

To Reproduce
Please include a code sample and launch.json configuration.
Here is the code sample :
#include<bits/stdc++.h>
using namespace std;
int main(){
printf("hi");
return 0;
}

Here is the 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": "gcc.exe - Build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${fileDirname}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "preLaunchTask": "C/C++: gcc.exe build active file"
    }
]

}

Here is the task.json :
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\MinGW\bin\gcc.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
Steps to reproduce the behavior:
just make a new file with the cpp extension. copy paste the code. click on debugging provided u have included these json files. and u can see the error.

Additional context
If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your launch.json
Add any other context about the problem here including log or error messages in your Debug Console or Output windows.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con le configurazioni .vscode/launch.json e tasks.json mostrate nel report, quindi riproduci il debug di un nuovo file .cpp su Windows con la C/C++ extension. Confronta il riferimento alla pre-launch task con la task definita e verifica che la compilazione venga completata prima dell’inizio del debug; l’attività è completata quando il file C++ di esempio viene compilato e avviato sotto il debugger senza l’errore relativo al codice di uscita segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, vscode
Ambito
devtools
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.