0

我正在尝试使用代码块进行调试,但无法使其正常工作。我收到以下消息:

Building to ensure sources are up-to-date
Build succeeded
Selecting target: 
femtosim
Adding source dir: /home/dlopez/Simulator/build/
Adding source dir: /home/dlopez/Simulator/
Changing directory to: /home/dlopez/Simulator/build/femtosim
Adding file: /home/dlopez/Simulator/build/femtosim/femtosim
Starting debugger: 
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
(no debugging symbols found)...done.
Debugger name and version: GNU gdb (GDB) 7.1-ubuntu
No symbol table is loaded.  Use the "file" command.
Breakpoint 1 ("/home/dlopez/Simulator/femtosim/main.cpp:71) pending.
Program exited with code 01.
Debugger finished with status 0

构建日志:

cd /home/dlopez/Simulator/build && /usr/bin/make -f CMakeFiles/Makefile2 femtosim/CMakeFiles/femtosim.dir/rule
make[1]: Entering directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -H/home/dlopez/Simulator -B/home/dlopez/Simulator/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/dlopez/Simulator/build/CMakeFiles 83
/usr/bin/make -f CMakeFiles/Makefile2 femtosim/CMakeFiles/femtosim.dir/all
make[2]: Entering directory `/home/dlopez/Simulator/build'
/usr/bin/make -f femtosim/CMakeFiles/femtosim-lib.dir/build.make femtosim/CMakeFiles/femtosim-lib.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/femtosim /home/dlopez/Simulator/build /home/dlopez/Simulator/build/femtosim /home/dlopez/Simulator/build/femtosim/CMakeFiles/femtosim-lib.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f femtosim/CMakeFiles/femtosim-lib.dir/build.make femtosim/CMakeFiles/femtosim-lib.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `femtosim/CMakeFiles/femtosim-lib.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
[ 34%] Built target femtosim-lib
/usr/bin/make -f json/CMakeFiles/json.dir/build.make json/CMakeFiles/json.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/json /home/dlopez/Simulator/build /home/dlopez/Simulator/build/json /home/dlopez/Simulator/build/json/CMakeFiles/json.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f json/CMakeFiles/json.dir/build.make json/CMakeFiles/json.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `json/CMakeFiles/json.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  75 76 77
[ 38%] Built target json
/usr/bin/make -f lemon/CMakeFiles/lemon.dir/build.make lemon/CMakeFiles/lemon.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/lemon /home/dlopez/Simulator/build /home/dlopez/Simulator/build/lemon /home/dlopez/Simulator/build/lemon/CMakeFiles/lemon.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f lemon/CMakeFiles/lemon.dir/build.make lemon/CMakeFiles/lemon.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `lemon/CMakeFiles/lemon.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  78 79 80 81 82 83 84
[ 46%] Built target lemon
/usr/bin/make -f cwind/CMakeFiles/cwind.dir/build.make cwind/CMakeFiles/cwind.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/cwind /home/dlopez/Simulator/build /home/dlopez/Simulator/build/cwind /home/dlopez/Simulator/build/cwind/CMakeFiles/cwind.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f cwind/CMakeFiles/cwind.dir/build.make cwind/CMakeFiles/cwind.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `cwind/CMakeFiles/cwind.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
[ 98%] Built target cwind
/usr/bin/make -f femtosim/CMakeFiles/femtosim.dir/build.make femtosim/CMakeFiles/femtosim.dir/depend
make[3]: Entering directory `/home/dlopez/Simulator/build'
cd /home/dlopez/Simulator/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/dlopez/Simulator /home/dlopez/Simulator/femtosim /home/dlopez/Simulator/build /home/dlopez/Simulator/build/femtosim /home/dlopez/Simulator/build/femtosim/CMakeFiles/femtosim.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/make -f femtosim/CMakeFiles/femtosim.dir/build.make femtosim/CMakeFiles/femtosim.dir/build
make[3]: Entering directory `/home/dlopez/Simulator/build'
make[3]: Nothing to be done for `femtosim/CMakeFiles/femtosim.dir/build'.
make[3]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_report /home/dlopez/Simulator/build/CMakeFiles  45
[100%] Built target femtosim
make[2]: Leaving directory `/home/dlopez/Simulator/build'
/usr/bin/cmake -E cmake_progress_start /home/dlopez/Simulator/build/CMakeFiles 0
make[1]: Leaving directory `/home/dlopez/Simulator/build'
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

注意:

  • 我曾使用外部 cmake 来构建我的项目

  • 在项目构建选项中,我正在检查生成调试符号 [-g]。

我需要设置其他路径吗

这是我的 Cmake 文件:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

SET(PROJECT_NAME "CWIND-NG")
SET(PROJECT_VERSION_MAJOR "0")
SET(PROJECT_VERSION_MINOR "1")
SET(PROJECT_VERSION_PATCH "0")
SET(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")

PROJECT(${PROJECT_NAME})

CONFIGURE_FILE(
  ${CMAKE_SOURCE_DIR}/doc/Doxyfile.in
  ${CMAKE_BINARY_DIR}/doc/Doxyfile
  @ONLY
)

SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

SET(ENABLE_MPI OFF CACHE BOOL "MPI support.")

IF(ENABLE_MPI)
  FIND_PACKAGE(MPI REQUIRED)
  FIND_PACKAGE(Boost 1.36.0 REQUIRED serialization mpi)
  ADD_DEFINITIONS(-DENABLE_MPI)
ENDIF(ENABLE_MPI)

IF(CMAKE_COMPILER_IS_GNUCXX)
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ansi")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

IF(MSVC)
  ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE)
ENDIF(MSVC)

SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DCWIND_ASSERTS_ENABLED")

SET(ENABLE_CUFDSIM OFF CACHE BOOL "Build CuFDSim as subproject.")
IF(ENABLE_CUFDSIM)
  ADD_SUBDIRECTORY(CuFDSim)
ENDIF(ENABLE_CUFDSIM)

ADD_SUBDIRECTORY(json)
ADD_SUBDIRECTORY(lemon)
ADD_SUBDIRECTORY(cwind)
ADD_SUBDIRECTORY(bin)
ADD_SUBDIRECTORY(femtosim)
ADD_SUBDIRECTORY(ltesim)

IF(UNIX)
  ADD_CUSTOM_TARGET(html
#    COMMAND rm -rf html
    COMMAND doxygen Doxyfile
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
ELSEIF(WIN32)
  ADD_CUSTOM_TARGET(html
#    COMMAND if exist html rmdir /s /q html
    COMMAND doxygen Doxyfile
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
ENDIF(UNIX)
4

1 回答 1

1

(未找到调试符号)...完成。

这是调试失败的主要原因。

该项目是使用cmake配置编译的,IDE中的-g设置完全没有用,因此CMakeListes.txt中缺少调试配置导致缺少调试符号。

请参考此链接

使用调试配置重新生成 Makefile,目标将包含调试符号。

于 2013-05-06T00:04:57.450 回答