任何人使用Visual Studio代码在C中编程吗?请告诉我,当我使用g编译器编译Visual Studio代码时,我如何管理在Visual Studio代码中调试我的代码。
yqlxgs2m1#
C调试需要几个步骤来为它配置VSCode。一旦完成,C代码就可以很容易地用F5进行调试。我写了一篇指导如何在VSCode中运行和调试C/C++文件的文章。https://medium.com/@jerrygoyal/run-debug-intellisense-c-c-in-vscode-within-5-minutes-3ed956e059d6
fbcarpbf2#
用于调试项目目录中的多个cpp文件。您的launch.json和task.json应该如下所示
tasks.json { "type": "cppbuild", "label": "C/C++: g++.exe build active file", "command": "C:\\MinGW\\bin\\g++.exe", "args": [ "-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${workspaceFolder}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "Task generated by Debugger." } launch.json { "name": "g++.exe - Build and debug active file", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "C/C++: g++.exe build active file" }
2条答案
按热度按时间yqlxgs2m1#
C调试需要几个步骤来为它配置VSCode。一旦完成,C代码就可以很容易地用F5进行调试。
我写了一篇指导如何在VSCode中运行和调试C/C++文件的文章。
https://medium.com/@jerrygoyal/run-debug-intellisense-c-c-in-vscode-within-5-minutes-3ed956e059d6
fbcarpbf2#
用于调试项目目录中的多个cpp文件。
您的launch.json和task.json应该如下所示