我在github.com/RainerKuemmerle/g2o编译了c++代码库添加后使用cmake
set(CMAKE_BUILD_TYPE Debug)
以便能够调试应用程序。然后它创建了一个名为“g2o”的构建文件。但是当我尝试使用 gdb 进行调试时,这是我得到的输出。
user2@arm_machine:~/g2o/trunk/bin$ gdb g2o
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /scratch/mbaxkms7/ARM_Programs_mbaxkms7/g2o/trunk/bin/g2o...(no debugging symbols found)...done.
(gdb)
在使用cmake时有没有其他方法可以生成调试信息?
最佳答案
您添加 set(CMAKE_BUILD_TYPE Debug)
的方法工作正常。
但是 g2o
是使用 Release
选项构建的程序。 g2o
的Debug
版本称为g2o_d
。因此,要进行调试,您需要按以下方式启动调试器:
user2@arm_machine:~/g2o/trunk/bin$ gdb g2o_d
注意
不同的名称不是 CMake
的共同特征,而是 g2o
的共同特征 project :
# postfix, based on type
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "postfix applied to debug build of libraries")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "postfix applied to release build of libraries")
关于c++ - 使用 cmake 时未创建调试符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24848983/