一、安装bear包。

ubuntu下使用:    sudo apt install bear

archlinux下使用:sudo pacman -S bear

安装之后使用bear --version查看版本,我安装的版本是3.1.5

二、编译makefile文件使生成我们要的文件

命令:bear -- make,注意要在你makefile文件所在目录中执行。

三、vscode配置

在task.json中添加以下任务 

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build and run",
            "type": "shell",
            "command": "make",
            "args": [
                "&&",
                "./build/bin/demo"
            ]
        },
        {
            "label": "bear",
            "type": "shell",
            "command": "bear",
            "args": [
                "--",
                "make",
                "&&",
                "./build/bin/demo"
            ]
        },
        {
            "label": "clean",
            "type": "shell",
            "command":"make",
            "args": [
                "clean"
            ]
        }
    ]
}

接下来大家都懂了!

不会关注发评论区

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐