开发者

How to use GDB debug OpenCV programmes?

I wrote an Open开发者_开发问答CV program, compiled by gcc -g *.o -o *, run successfully. However, when i try to use gdb debug this program, like gdb cvmat, it doesn't work. How can i use gdb debug an opencv program?


While your program is compiled with debugging symbols (using the -g flag), it sounds like OpenCV was not. Try rebuilding your OpenCV installation with debugging symbols by setting CMAKE_BUILD_TYPE to Debug or RelWithDebInfo when configuring your build with ccmake.


I had no luck with -D CMAKE_BUILD_TYPE=Debug. I could use the resulting library, but I wasn't able to debug inside OpenCV functions. Using cmake-gui didn't fix things for me either.

I was able to debug inside OpenCV by manually compiling the library components that I was interested in...

g++ -g -I ../../include/opencv/ -I ../../3rdparty/include/ cxlapack.cpp cxmatrix.cpp ../../lib/libcxcore.so my_source_file.cpp


Combination cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -D CMAKE_BUILD_TYPE=DEBUG successfully appends debug information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜