【darknet】win10 vscode单步调试darknet配置

参考自:https://www.cnblogs.com/ranjiewen/p/10214728.html,
https://blog.csdn.net/xxmhnu/article/details/80280006

1. 安装vscode

2. 编译darknet

  • 将darknet中makefile的CC=gcc改为 CC=gcc -g

参考:https://blog.csdn.net/u011622208/article/details/105025271进行编译

3. vscode项目配置

  • vscode默认从系统和${workspaceFolder}(当前打开的文件夹,即darknet目录)下找头文件,所以我们要将工作区的include文件夹加入到配置文件中去。vscode下的C或C++项目的配置文件是c_cpp_properties.json,用快捷键ctrl+shift+p调出vscode命令搜索框,搜索Edit Configurations并点击就会跳转到c_cpp_properties.json文件的编辑界面,将include加入到includePath即可:
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/include"       // 添加了这一句
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "8.1",
            "compilerPath": "F:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}
  • task.json文件配置
    要启动调试,vscode需要知道编译的可调式的可执行文件的目录,以及带进去的参数,这些内容需要配置到launch.json中。按F5启动调试,选择GDB环境,编辑launch.json如下所示:
    共4个需要修改的地方,注释中有编号
{
    // 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": "(gdb) 启动",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/darknet.exe",        // 1.
            "args": ["detector", "demo", "cfg/coco.data", "cfg/yolov3.cfg", "models/yolov3.weights", "data/dog.jpg"],     // 2
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,                            // 3
            "MIMode": "gdb",
            "miDebuggerPath": "F:/cygwin64/bin/gdb.exe",        // 4
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

4. 调试项目

在examples/darknet.c的main函数中添加一个断点,然后按F5进行调试。
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值