无法使用 cmake 项目在 QT Creator 中进行调试

Can't debug in QT creator with cmake project

我使用 CMake Build 创建了一个新的纯 C++ 项目。 当我设置断点并按下调试按钮时,我收到此消息:

This does not seem to be a "Debug" build.
Setting breakpoints by file name and line number may fail.

Section .debug_info: Not found.
Section .debug_abbrev: Not found.
Section .debug_line: Not found.
Section .debug_str: Not found.
Section .debug_loc: Not found.
Section .debug_range: Not found.
Section .gdb_index: Not found.
Section .note.gnu.build-id: Found.
Section .gnu.hash: Found.
Section .gnu_debuglink: Not found.

您可以将此 CMake 参数 添加到您的 Build Settings:

-DCMAKE_BUILD_TYPE=Debug