安装gdb-imagewatch
依赖: Qt5.6+, python3, gdb7.10+支持python3.
具体参照 https://github.com/csantosbh/gdb-imagewatch 的说明.
1,下载gdb-imagewatch(后两步很重要,如果执行init失败,可以先去执行update,再执行init,updata)
git clone https://github.com/csantosbh/gdb-imagewatch
cd gdb-imagewatch
git submodule init
git submodule update
2,编译安装
mkdir build && cd build
qmake .. BUILD_MODE=release PREFIX=/path/to/installation/folder
make -j4
make install
3,配置gdb
编辑~/.gdbinit
文件, 没有就创建, gdb会在启动时自动调用本文件,文件内写入
source /path/to/installation/folder/bin/gdb-imagewatch/gdb-imagewatch.py
4,测试
python3 /path/to/installation/folder/bin/gdb-imagewatch/gdb-imagewatch.py --test
出现以下图,就说明安装成功!
vscode 里 配置:
{
// 有关 tasks.json 格式的文档,请参见
// https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"label": "catkin_make:build", //代表提示的描述性信息
"type": "shell", //可以选择shell或者process,如果是shell代码是在shell里面运行一个命令,如果是process代表作为一个进程来运行
"command": "catkin_make",//这个是我们需要运行的命令
// "args": [],//如果需要在命令后面加一些后缀,可以写在这里,比如-DCATKIN_WHITELIST_PACKAGES=“pac1;pac2”
"args": [
// "--directory",
// "/home/y/projects/test_planner2",
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"
],
"group": {"kind":"build","isDefault":true},
"presentation": {
"reveal": "always"//可选always或者silence,代表是否输出信息
},
"problemMatcher": "$msCompile"
}
]
}
CMakeLists.txt配置:
# find_package(OpenCV 3 REQUIRED) # ubuntu18.04,根据系统选择
# find_package(OpenCV 4 REQUIRED) # ubuntu20.04,根据系统选择
find_package(OpenCV REQUIRED) # 也可以这样
add_executable(opencv_learn src/opencv_learn.cpp)
add_dependencies(opencv_learn ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(opencv_learn
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
quickopencv
)
cpp文件需要包涵头文件:#include <opencv2/opencv.hpp>