今天需要用到debug,想到还得写文字,就想偷个懒,制作了两个宏定义,如下,以后需要的地方直接调用宏定义就好
定义两个的原因是写msg默认值时候,会报错,为了简便,就定义两个
#include <QDebug>
#define myDebugMsg(msg) qDebug()<<QString("[Debug] File:%1 Line:%2 Function:%3 Msg:%4").arg(__FILE__).arg(__LINE__).arg(__FUNCTION__).arg(msg)
#define myDebug() qDebug()<<QString("[Debug] File:%1 Line:%2 Function:%3").arg(__FILE__).arg(__LINE__).arg(__FUNCTION__)
使用如下
qt c++打印debug信息qDebug __FUNCTION__ __LINE__ __FILE__
原文:https://www.cnblogs.com/RYSBlog/p/14040877.html