Unsolved QT_DEBUG and #include <QDebug>
-
I would like to know if is a "good pratice" to include <QDebug> only in QT_DEBUG mode. Like
#ifdef QT_DEBUG #include <QDebug> #endif
Or Qt Creator IDE already include the <QDebug> library only in debug mode automatically.
Thank you,
-
Hi
well, its fine if you really want it gone in Release mode.
It's not removed and still active in Release. Creator do not alter includes.You can do
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
in the .pro file
to disable qDebug()so if you combine that with #ifdef QT_DEBUG
then i guess it would make sense.This is just my personal opinion and might not be universally accepted
as best practice :) -
Hi @fem_dev,
the very best you can do is to switch to categorized logging.
With that, you can turn on and off the debug messages at runtime, even in a release build and even on your customers machine far away.
Can be a lifesaver ;)
Regards
-
@aha_1980
hi
For some reason, the link did not work for me. but it seems correct !?
so just in case:
blog.qt.io/blog/2014/03/11/qt-weekly-1-categorized-logging -
@mrjj said in QT_DEBUG and #include <QDebug>:
seems correct !?
yes, same for me
it looks like forum Link feature is broken ?
link -
You are missing the https:// on front of the url.
@LeLev I fixed the link. -
@SGaist true! i fixed also
my bad