赞
踩
- {
- "version": "0.2.0",
- "configurations": [
- {
- "name": "(gdb) 启动",
- "type": "cppdbg", //配置类型
- "request": "launch",
- "program": "${workspaceFolder}\\${fileBasenameNoExtension}.exe", //调试时执行文件的路径
- "args": [], //调试时需要的参数
- "stopAtEntry": false, //可选参数。如果为 true,则调试程序应在目标的入口点处停止。如果传递了 processId,则不起任何作用。
- "cwd": "${workspaceFolder}", //目标的工作目录(项目的根目录)
- "environment": [],
- "externalConsole": false, //是否显示工作台
- "MIMode": "gdb",
- "miDebuggerPath": "D:\\ldt\\soft\\mingw64\\mingw64\\bin\\gdb.exe", //gdb.exe文件的路径
- "setupCommands": [
- {
- "description": "为 gdb 启用整齐打印",
- "text": "-enable-pretty-printing",
- "ignoreFailures": true
- },
- {
- "description": "将反汇编风格设置为 Intel",
- "text": "-gdb-set disassembly-flavor intel",
- "ignoreFailures": true
- }
- ],
- "preLaunchTask": "g++" //调试之前需要运行的任务,也就是tasks.json文件,"g++"与tasks.json文件中的"label"一致
- // "postDebugTask": ,需要与这个函数进行区分,postDebugTask参数表示在调试之前所需要执行的任务
- }
-
- ]
- }
- {
- "tasks": [
- {
- "type": "cppbuild", //任务类型
- "label": "g++", //任务名称,与launch.json文件的preLaunchTask参数相同(必须)
- "command": "D:/ldt/soft/mingw64/mingw64/bin/g++.exe", //执行编译的编译器或脚本的路径
- "args": [ //args相当于执行 g++ ....cpp -o ....exe
- "-fdiagnostics-color=always",
- "-g",
- "${file}",
- "-o",
- "${workspaceFolder}\\${fileBasenameNoExtension}.exe"
- ],
- "options": {
- "cwd": "D:/ldt/soft/mingw64/mingw64/bin" //g++,gdb之类的脚本或者可执行文件的工作目录
- },
- "problemMatcher": [
- "$gcc"
- ],
- "group": {
- "kind": "build",
- "isDefault": true
- },
- "detail": "调试器生成的任务。"
- }
- ],
- "version": "2.0.0"
- }
如果有第三方库引入,则需要配置c_cpp_properties.json和tasks.json文件,我这里引用的是openssl。
tasks.json
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。