Solved Why does this defined QT_NO_DEBUG_OUTPUT not supress the qDebug?
-
Hi
Did you make a release build ?
As far as i know, QT_NO_DEBUG_OUTPUT removes qDebug for release builds only. -
Oh, I was doing a Debug build. I switched to release build, cleaned, ran qmake, did a build, and did Ctrl+R to run, but the qDebug message is still showing in QtCreator's Application Output. Do you know anything else I can try?
-
@DragonautX
Ok that's odd.
I use
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUTLet me check if it still works :)
-
Oh wait, it's my .pro file that's the problem. I added the line you said you used, cleaned, qmake, built, and ran, and it worked. I didn't know you were supposed to add that line to your .pro. I thought a
#define
would work just fine by itself?QT += widgets SOURCES += \ main.cpp CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
-
@DragonautX
seems fine. make sure to really clean build folder. -
@DragonautX
Just tested in this sample
https://www.dropbox.com/s/oaf75jo0awpm1fc/mydebug.zip?dl=0
Works here in Qt5.7 win 10. -
Ya, it worked. I guess I was clicking too fast and forgot to really clean. It works for both the #define preprocessor and the .pro code. Anyways, thanks for the help and uploading an example too. That was helpful. I'll make sure to check next time if I'm Debug or Release mode.
-
@DragonautX
Super
As last note:
I find this pretty niceqDebug()<<__FILE__<<__LINE__<<__PRETTY_FUNCTION__;
-
That's pretty cool. Didn't know predefined macros like that were there before. wasn't able to use
__PRETTY_FUNCTION__
, but__FUNCTION__
worked. From SO, seems like__PRETTY_FUNCTION__
is only for some gcc compiler, and Qt says I'm using mvsc. Is it supposed to work with mvsc too? That's how all my test projects have been compiled on so far by Qt. -
@DragonautX said in Why does this defined QT_NO_DEBUG_OUTPUT not supress the qDebug?:
PRETTY_FUNCTION
oh yes, sorry, its gcc
I think Vs have__FUNCDNAME__; // Decorated __FUNCSIG__; // Signature and __FUNCTION__; //should be same
Didnt test lately, but it does have something the same.
-
Alright, cool. Thanks for the tip!
-
Hi,
Otherwise you can use Q_FUNC_INFO. Shorter to write :)