Fix the problem of codeblocks breakpoints not working

  • 2020-06-23 01:19:12
  • OfStack

Reason 1 -- This is what I've seen, and it works

Note: set (ES4en_ES5en_Debug) is placed after project

Otherwise breakpoint debugging is invalid. Here is an example:


PROJECT (HELLO)

cmake_minimum_required(VERSION 2.8)

set (CMAKE_BUILD_TYPE Debug)



include_directories (

 include

 ./

 mavlink/include/mavlink/v1.0)

SET(SRC_LIST autopilot_interface.cpp

 src/BaseMavlinkControl.cpp

 mavlink_control.cpp

 serial_port.cpp)

set (thread_lib -pthread)

MESSAGE(STATUS "This is BINARY dir " ${HELLO_BINARY_DIR})

#MESSAGE(STATUS "This is SOURCE dir "${HELLO_SOURCE_DIR})

ADD_EXECUTABLE(hello ${SRC_LIST})

target_link_libraries (hello ${thread_lib})

The following is an excerpt of other online answers, are collected here, for your reference:

So I searched online for a long time and finally solved the problem. Now list the possible causes of the problem:

1. The -ES18en flag is not opened during compilation, resulting in no debug information, so debugging cannot be done. - After testing, remove can also be debugging

Solution: In debug mode: set - > Compiler and debugger Settings - > Global compiler Settings - > Compiler Settings

Click to generate debug symbol -g

2. project path contains Chinese characters, causing breakpoints.

The solution: Turn the project path into no characters, of course.


Related articles: