首页 > 解决方案 > GDB 不会在 Qt 项目中的断点处停止

问题描述

创建了默认Qt Widgets Application项目,在所有 func 行放置了断点,main但它们都没有被触发F5(启动项目的启动调试)\ F10(在 main 上启动和中断)。任何其他项目都会发生同样的事情。

代码:

#include "mainwindow.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}

我的工具包屏幕截图(所有编译器(包括选择)都由 Qt 自动检测并由 Qt Installer 提供)。

在此处输入图像描述

我的.pro文件:

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    main.cpp \
    mainwindow.cpp

HEADERS += \
    mainwindow.h

FORMS += \
    mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

标签: c++qtgdb

解决方案


推荐阅读