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. Unable to see the QDebug Messages on console.
Forum Updated to NodeBB v4.3 + New Features

Unable to see the QDebug Messages on console.

Scheduled Pinned Locked Moved Unsolved General and Desktop
qdebugqt-5.7.1console
15 Posts 7 Posters 24.7k 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.
  • Vinod KuntojiV Offline
    Vinod KuntojiV Offline
    Vinod Kuntoji
    wrote on last edited by
    #4

    @Rohith ,

    Add,
    CONFIG += console

    C++, Qt, Qt Quick Developer,
    PthinkS, Bangalore

    1 Reply Last reply
    0
    • R Rohith

      @yuvaram

      Hi Yuvaram thanks for replying, here is my .pro file please check it out.

      TEMPLATE = app
      TARGET = CndM
      INCLUDEPATH += .
      QT+=  core widgets gui sql
      OUTPUT += Console
      # Input
      HEADERS += database.h widget.h
      FORMS += widget.ui
      SOURCES += database.cpp main.cpp widget.cpp
      
      yuvaramY Offline
      yuvaramY Offline
      yuvaram
      wrote on last edited by
      #5

      @Rohith
      You need to add CONFIG type in profile, as shown
      TEMPLATE = app
      TARGET = CndM
      INCLUDEPATH += .
      QT+= core widgets gui sql
      CONFIG += console

      Input

      HEADERS += database.h widget.h
      FORMS += widget.ui
      SOURCES += database.cpp main.cpp widget.cpp

      Yuvaram Aligeti
      Embedded Qt Developer
      : )

      R 1 Reply Last reply
      0
      • yuvaramY yuvaram

        @Rohith
        You need to add CONFIG type in profile, as shown
        TEMPLATE = app
        TARGET = CndM
        INCLUDEPATH += .
        QT+= core widgets gui sql
        CONFIG += console

        Input

        HEADERS += database.h widget.h
        FORMS += widget.ui
        SOURCES += database.cpp main.cpp widget.cpp

        R Offline
        R Offline
        Rohith
        wrote on last edited by
        #6

        @yuvaram

        Hi yuvaram and vijay thanks for replying, i have tried as per your suggestion but no use i am unable to see the qdebug messages.

        my new .pro file

        TEMPLATE = app
        TARGET = CndM
        INCLUDEPATH += .
        
        QT+= core widgets gui sql
        CONFIG += console
        
        # Input
        HEADERS += database.h widget.h
        FORMS += widget.ui
        SOURCES += database.cpp main.cpp widget.cpp
        
        J.HilkJ yuvaramY 2 Replies Last reply
        0
        • R Rohith

          @yuvaram

          Hi yuvaram and vijay thanks for replying, i have tried as per your suggestion but no use i am unable to see the qdebug messages.

          my new .pro file

          TEMPLATE = app
          TARGET = CndM
          INCLUDEPATH += .
          
          QT+= core widgets gui sql
          CONFIG += console
          
          # Input
          HEADERS += database.h widget.h
          FORMS += widget.ui
          SOURCES += database.cpp main.cpp widget.cpp
          
          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #7

          @Rohith
          you'll have to rerun qmake after changes in your *.pro file


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          R 1 Reply Last reply
          0
          • J.HilkJ J.Hilk

            @Rohith
            you'll have to rerun qmake after changes in your *.pro file

            R Offline
            R Offline
            Rohith
            wrote on last edited by
            #8

            @J.Hilk

            Hi Hilk thanks for replying, i have recompiled the project from start i.e
            i have done
            makedistclean
            qmake -project
            added all the inputs
            qmake
            make

            1 Reply Last reply
            0
            • R Rohith

              @yuvaram

              Hi yuvaram and vijay thanks for replying, i have tried as per your suggestion but no use i am unable to see the qdebug messages.

              my new .pro file

              TEMPLATE = app
              TARGET = CndM
              INCLUDEPATH += .
              
              QT+= core widgets gui sql
              CONFIG += console
              
              # Input
              HEADERS += database.h widget.h
              FORMS += widget.ui
              SOURCES += database.cpp main.cpp widget.cpp
              
              yuvaramY Offline
              yuvaramY Offline
              yuvaram
              wrote on last edited by
              #9

              @Rohith
              Try to delete build folder , then try clean, qmake, build, run

              Yuvaram Aligeti
              Embedded Qt Developer
              : )

              R 1 Reply Last reply
              0
              • yuvaramY yuvaram

                @Rohith
                Try to delete build folder , then try clean, qmake, build, run

                R Offline
                R Offline
                Rohith
                wrote on last edited by
                #10

                @yuvaram

                Hi Yuvaram,

                There is no separate build folder for my project, i am compiling through command line.
                What is your intention i am following the same thing i am doing i.e fresh compilation, but still unable to see the messages.

                1 Reply Last reply
                0
                • Vinod KuntojiV Offline
                  Vinod KuntojiV Offline
                  Vinod Kuntoji
                  wrote on last edited by
                  #11

                  @Rohith ,

                  Try compiling your code through Qt Creator, and check the qDebugs in application output?

                  C++, Qt, Qt Quick Developer,
                  PthinkS, Bangalore

                  1 Reply Last reply
                  0
                  • hskoglundH Offline
                    hskoglundH Offline
                    hskoglund
                    wrote on last edited by
                    #12

                    Hi, also, as a workaround, you can capture all qDebug messages and print them out yourself, just call qInstallMessageHandler, say like this:

                    #include "stdio.h"
                    void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
                    {
                        printf(qUtf8Printable(msg));
                        printf("\n");
                    }
                    
                    int main(int argc, char *argv[])
                    {
                        qInstallMessageHandler(messageHandler);
                    
                        QApplication a(argc, argv);
                        MainWindow w;
                        w.show();
                    
                        return a.exec();
                    }
                    
                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      TM9412
                      wrote on last edited by
                      #13

                      Hi @Rohith and others

                      Are you able to print the q debug message on console ??

                      I am also trying to print the QDebug Messages on console but it is not printing

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

                        Hi @Rohith,

                        i am unable to see the debug messages on the linux console

                        Try running your application after:

                        export QT_LOGGING_RULES="*.debug=true"
                        

                        The default message handler decides whether or not to filter debug messages (indeed, all log categories and/or levels) based on rules loaded in five different places (see "Order of evaluation" under QLoggingCategory - Logging Rules). And recent versions of Linux (Ubuntu at least, and Fedora I've read) ship with debug output disabled by default. You can enable debug output a number of ways (see the previous link), and can even decide which components to log at which levels (eg enable debug logging of Qt's network components if you wish). It's pretty powerful, but a little bit complex IMO.

                        Another way is:

                        QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, true);
                        

                        I sometimes like to do that in response to a -d or --debug command line option.

                        Cheers.

                        1 Reply Last reply
                        2
                        • T Offline
                          T Offline
                          TM9412
                          wrote on last edited by
                          #15

                          correct @Paul-Colby
                          thanks

                          1 Reply Last reply
                          0

                          • Login

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