Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Enable QMessageLogContext in release build
Forum Updated to NodeBB v4.3 + New Features

Enable QMessageLogContext in release build

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 2.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • beeckscheB Offline
    beeckscheB Offline
    beecksche
    wrote on last edited by
    #1

    Hi,
    i want to enable the QMessageLogContext 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!

    1 Reply Last reply
    0
    • Paul ColbyP Offline
      Paul ColbyP Offline
      Paul Colby
      wrote on last edited by
      #2

      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.

      beeckscheB 1 Reply Last reply
      2
      • Paul ColbyP Paul Colby

        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.

        beeckscheB Offline
        beeckscheB Offline
        beecksche
        wrote on last edited by beecksche
        #3

        @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.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved