Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qDebug() doesn't show messages in Qt Creator/Application Output

qDebug() doesn't show messages in Qt Creator/Application Output

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
45 Posts 8 Posters 4.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.
  • M MHMart_asc

    image.png

    image.png

    Maybe I have the wrong debugger?

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #36

    @MHMart_asc
    As I wrote:: lldb is not normally a debugger you use with MSVC. It shows as in your Qt installation area. That probably comes from the MinGW you show you also have.

    Under Windows you have to choose between two possible toolchains. The MinGW one (like gcc + gdb or lldb) or the MSVC one (MSVC compiler & linker and Visual Studio and debugger). I think you have a cross between the two. If you wish to use the MSVC C/C++ compiler, as shown in your screenshot, you should not be using an external debugger, you should be using the one which is part of MSVC. I do not know why you have lldb or what exactly you should do to correct it, but you should do whatever to sort it out.

    M 1 Reply Last reply
    1
    • JonBJ JonB

      @MHMart_asc
      As I wrote:: lldb is not normally a debugger you use with MSVC. It shows as in your Qt installation area. That probably comes from the MinGW you show you also have.

      Under Windows you have to choose between two possible toolchains. The MinGW one (like gcc + gdb or lldb) or the MSVC one (MSVC compiler & linker and Visual Studio and debugger). I think you have a cross between the two. If you wish to use the MSVC C/C++ compiler, as shown in your screenshot, you should not be using an external debugger, you should be using the one which is part of MSVC. I do not know why you have lldb or what exactly you should do to correct it, but you should do whatever to sort it out.

      M Offline
      M Offline
      MHMart_asc
      wrote on last edited by
      #37

      @JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:

      @MHMart_asc
      As I wrote:: lldb is not normally a debugger you use with MSVC. It shows as in your Qt installation area. That probably comes from the MinGW you show you also have.

      Under Windows you have to choose between two possible toolchains. The MinGW one (like gcc + gdb or lldb) or the MSVC one (MSVC compiler & linker and Visual Studio and debugger). I think you have a cross between the two. If you wish to use the MSVC C/C++ compiler, as shown in your screenshot, you should not be using an external debugger, you should be using the one which is part of MSVC. I do not know why you have lldb or what exactly you should do to correct it, but you should do whatever to sort it out.

      You were completely right! I now installed windows debugger from the maintenance tool and that helped (a bit).

      I now do get output when using OutputDebugString(".."). But nothing yet when using qDebug() << "...";

      I do get this error though:
      onecore\windows\directx\database\helperlibrary\lib\perappusersettingsqueryimpl.cpp(159)\directxdatabasehelper.dll!00007FF96BB8FEED: (caller: 00007FF96BB8FD30) ReturnHr(5) tid(4b1c) 80070002 Het systeem kan het opgegeven bestand niet vinden.

      0f5e95f4-95f5-4dbb-b2f9-bf9379f80a95-image.png

      So getting there. So dumb of me to have the wrong debugger

      1 Reply Last reply
      0
      • M MHMart_asc

        image.png

        image.png

        Maybe I have the wrong debugger?

        cristian-adamC Offline
        cristian-adamC Offline
        cristian-adam
        wrote on last edited by
        #38

        @MHMart_asc For some reason you got lldb set as debugger.

        lldb shipped with Qt Creator can debug MSVC programs, since lldb upstream can do this.

        lldb can also do post mortem debugging by loading a minidump file, which Qt Creator with cdb cannot. It also might be faster than cdb.

        In order to get the qDebug() calls printed, just make sure to:

        1. Make sure to have Run in terminal checked
        2. Set the environment variable QT_WIN_DEBUG_CONSOLE=attach

        Then as seen in the picture below, things are just fine:

        qt-creator-18-windows-msvc-2022-arm64-lldb.png

        M JonBJ 2 Replies Last reply
        0
        • cristian-adamC cristian-adam

          @MHMart_asc For some reason you got lldb set as debugger.

          lldb shipped with Qt Creator can debug MSVC programs, since lldb upstream can do this.

          lldb can also do post mortem debugging by loading a minidump file, which Qt Creator with cdb cannot. It also might be faster than cdb.

          In order to get the qDebug() calls printed, just make sure to:

          1. Make sure to have Run in terminal checked
          2. Set the environment variable QT_WIN_DEBUG_CONSOLE=attach

          Then as seen in the picture below, things are just fine:

          qt-creator-18-windows-msvc-2022-arm64-lldb.png

          M Offline
          M Offline
          MHMart_asc
          wrote on last edited by
          #39

          @cristian-adam said in qDebug() doesn't show messages in Qt Creator/Application Output:

          @MHMart_asc For some reason you got lldb set as debugger.

          lldb shipped with Qt Creator can debug MSVC programs, since lldb upstream can do this.

          lldb can also do post mortem debugging by loading a minidump file, which Qt Creator with cdb cannot. It also might be faster than cdb.

          In order to get the qDebug() calls printed, just make sure to:

          1. Make sure to have Run in terminal checked
          2. Set the environment variable QT_WIN_DEBUG_CONSOLE=attach

          Then as seen in the picture below, things are just fine:

          qt-creator-18-windows-msvc-2022-arm64-lldb.png

          Run in terminal now works, that is true! still strange that i'm not seeing this in application output though but anyhow this helps enough!

          1 Reply Last reply
          1
          • cristian-adamC cristian-adam

            @MHMart_asc For some reason you got lldb set as debugger.

            lldb shipped with Qt Creator can debug MSVC programs, since lldb upstream can do this.

            lldb can also do post mortem debugging by loading a minidump file, which Qt Creator with cdb cannot. It also might be faster than cdb.

            In order to get the qDebug() calls printed, just make sure to:

            1. Make sure to have Run in terminal checked
            2. Set the environment variable QT_WIN_DEBUG_CONSOLE=attach

            Then as seen in the picture below, things are just fine:

            qt-creator-18-windows-msvc-2022-arm64-lldb.png

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #40

            @cristian-adam said in qDebug() doesn't show messages in Qt Creator/Application Output:

            lldb shipped with Qt Creator can debug MSVC programs, since lldb upstream can do this.

            As I have written, I am not a Windows/Qt user, but always interested to learn to help others in future. When we used MSVC/VS years ago we used compiler/linker/debugger from that. Are you saying that, if you choose to develop/debug in Creator rather than Visual Studio, you use the compiler/linker from MSVC --- because these can be invoked via command line from Creator/make --- but you do not use whatever debugger MSVC/VS comes with, because that is for visual use in Visual Studio only? But Creator can "drive" some lldb debugger (or cdb) under Windows like it does on gdb from Linux, so you use one of those?

            cristian-adamC 1 Reply Last reply
            0
            • JonBJ JonB

              @cristian-adam said in qDebug() doesn't show messages in Qt Creator/Application Output:

              lldb shipped with Qt Creator can debug MSVC programs, since lldb upstream can do this.

              As I have written, I am not a Windows/Qt user, but always interested to learn to help others in future. When we used MSVC/VS years ago we used compiler/linker/debugger from that. Are you saying that, if you choose to develop/debug in Creator rather than Visual Studio, you use the compiler/linker from MSVC --- because these can be invoked via command line from Creator/make --- but you do not use whatever debugger MSVC/VS comes with, because that is for visual use in Visual Studio only? But Creator can "drive" some lldb debugger (or cdb) under Windows like it does on gdb from Linux, so you use one of those?

              cristian-adamC Offline
              cristian-adamC Offline
              cristian-adam
              wrote on last edited by
              #41

              @JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:

              but you do not use whatever debugger MSVC/VS comes with, because that is for visual use in Visual Studio only? But Creator can "drive" some lldb debugger (or cdb) under Windows like it does on gdb from Linux, so you use one of those?

              Yes. On Windows the proper debugger can only be used by Microsoft products, either Visual Studio or Visual Studio Code.

              cdb is their command line debugger, part of the Windows Driver SDK, and Qt Creator has a dll extension plugin which exposes a Python interface like for gdb and lldb on Linux / macOS.

              But, lldb knows how to use pdb debugger files, and can handle MSVC binaries.

              This makes lldb the one of the few open source debuggers on Windows that can handle MSVC compiled debug programs!

              JonBJ 1 Reply Last reply
              2
              • cristian-adamC cristian-adam

                @JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:

                but you do not use whatever debugger MSVC/VS comes with, because that is for visual use in Visual Studio only? But Creator can "drive" some lldb debugger (or cdb) under Windows like it does on gdb from Linux, so you use one of those?

                Yes. On Windows the proper debugger can only be used by Microsoft products, either Visual Studio or Visual Studio Code.

                cdb is their command line debugger, part of the Windows Driver SDK, and Qt Creator has a dll extension plugin which exposes a Python interface like for gdb and lldb on Linux / macOS.

                But, lldb knows how to use pdb debugger files, and can handle MSVC binaries.

                This makes lldb the one of the few open source debuggers on Windows that can handle MSVC compiled debug programs!

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #42

                @cristian-adam said in qDebug() doesn't show messages in Qt Creator/Application Output:

                Yes. On Windows the proper debugger can only be used by Microsoft products, either Visual Studio or Visual Studio Code.

                So, to be 100% clear: the debugger I used for MSVC code from within VS is integrated with/cannot be separated from VS? It is not cdb (nor lldb), it is not a "standalone" debugger, it must be used from some visual VS thingie? So while they made MSVC compiler and link external tools they did not expose an "interface" to the debugger part? But gdb does allow external "driving"? Of course for me using the MS stuff all inside VS I didn't worry too much about what was what.

                cristian-adamC 1 Reply Last reply
                0
                • JonBJ JonB

                  @cristian-adam said in qDebug() doesn't show messages in Qt Creator/Application Output:

                  Yes. On Windows the proper debugger can only be used by Microsoft products, either Visual Studio or Visual Studio Code.

                  So, to be 100% clear: the debugger I used for MSVC code from within VS is integrated with/cannot be separated from VS? It is not cdb (nor lldb), it is not a "standalone" debugger, it must be used from some visual VS thingie? So while they made MSVC compiler and link external tools they did not expose an "interface" to the debugger part? But gdb does allow external "driving"? Of course for me using the MS stuff all inside VS I didn't worry too much about what was what.

                  cristian-adamC Offline
                  cristian-adamC Offline
                  cristian-adam
                  wrote on last edited by
                  #43

                  @JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:

                  So while they made MSVC compiler and link external tools they did not expose an "interface" to the debugger part? But gdb does allow external "driving"? Of course for me using the MS stuff all inside VS I didn't worry too much about what was what.

                  Yes. The premium debugging experience is reserved for Microsoft products, or, if you want to be a hacker, and break their EULA https://github.com/mfussenegger/nvim-dap/discussions/869

                  I think CLion has their own version of lldb in which they optimized some things.

                  gdb on Windows can only debug DWARF, cannot do PDB.

                  JonBJ 1 Reply Last reply
                  2
                  • cristian-adamC cristian-adam

                    @JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:

                    So while they made MSVC compiler and link external tools they did not expose an "interface" to the debugger part? But gdb does allow external "driving"? Of course for me using the MS stuff all inside VS I didn't worry too much about what was what.

                    Yes. The premium debugging experience is reserved for Microsoft products, or, if you want to be a hacker, and break their EULA https://github.com/mfussenegger/nvim-dap/discussions/869

                    I think CLion has their own version of lldb in which they optimized some things.

                    gdb on Windows can only debug DWARF, cannot do PDB.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #44

                    @cristian-adam
                    Very interesting, thank you. It turns out there is some vsdbg.exe, which I take to be the actual debugger as its own executable. Which you can "drive", if you know what to send it.

                    I didn't care about DWARF, PDB etc. I was interested in which debuggers allow a host to "talk" to them and vice versa, send it commands, read variables, etc. Which is what Creator will require. I know gdb can do it. I didn't know there was a standalone executable for the debugger from VS, I thought it was a built in.

                    1 Reply Last reply
                    0
                    • cristian-adamC Offline
                      cristian-adamC Offline
                      cristian-adam
                      wrote last edited by
                      #45

                      This topic was also present as a bug report at https://qt-project.atlassian.net/browse/QTCREATORBUG-33741

                      Which I've fixed, and with Qt Creator 19 things would simply just work out of the box with lldb.exe.

                      1 Reply Last reply
                      2

                      • Login

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