本文介绍了为什么qDebug在Release版本中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自MFC,我处理 qDebug()很像 TRACE(),假设它从由预处理器释放构建(在MFC中,它使用 #define TRACE 1?(void *)0:AfxTrace )完成。

Coming from MFC, I treated qDebug() much like TRACE(), assuming that it is removed from Release builds by the preprocessor (in MFC it's done using #define TRACE 1 ? (void*) 0 : AfxTrace).

然而,令我惊讶的是, qDebug()也在发行版本中执行。如何更改这个?而且,为什么这样,Qt背后的开发者的推理是什么呢?

To my surprise, however, qDebug() is executed in Release builds as well. How do I change this? And also, why is this so, what was the reasoning of the developers of Qt behind this decision?

推荐答案

qDebug 也是预处理器控制的,但它有自己的特殊宏 QT_NO_DEBUG_OUTPUT 。如果您将它添加到您的版本构建定义,它将被删除。

qDebug is also preprocessor-controlled, but it has its own special macro, QT_NO_DEBUG_OUTPUT. If you add that to your Release build defines, it will be removed.

这篇关于为什么qDebug在Release版本中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 21:52