Solved Enable QMessageLogContext in release build
-
Hi,
i want to enable theQMessageLogContext
in my release build. I defined QT_MESSAGELOGCONTEXT (http://doc.qt.io/qt-5/qmessagelogcontext.html#details) in my main.cpp, but nothing changed.Can somone tell me what i'm doing wrong?
Thanks!
-
Hi @beecksche,
I defined QT_MESSAGELOGCONTEXT in my main.cpp, but nothing changed.
You probably need to define it more broadly (or at least before certain
#include
statements). The easiest way would be to add to your*.pro
(or*.pri
) file:DEFINES += QT_MESSAGELOGCONTEXT
Some examples in the wild: https://github.com/search?q=QT_MESSAGELOGCONTEXT&type=Code&utf8=✓
Cheers.
-
@Paul-Colby
I'm working with VS2013 and add QT_MESSAGELOGCONTEXT to the preprocessor definitions in the project settings. First i have forgotten to add the definitions in my additional libraries.I'm not sure if it is the same to define QT_MESSAGELOGCONTEXT in the source code, like:
main.cpp
#define QT_MESSAGELOGCONTEXT #incude ... int main(int argc, char *argv[]) { ... }
Thanks for help. Now it works perfectly.