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. Need help for using qDebug() with Qt plugin for Visual Studio 2008

Need help for using qDebug() with Qt plugin for Visual Studio 2008

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 6.2k Views
  • 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.
  • E Offline
    E Offline
    Ejay
    wrote on 8 Dec 2017, 08:27 last edited by
    #3

    @VRonin This is a GUI application. I just found out that i am getting debug messages on the small output window, the window where you see the build messages. However i want to see these messages on a console. This is necessary because i will be porting the application to Win CE7 where only console is helpful for actual debugging. This is a future embedded system code exercise therefore i have to use these nice and modern things only ;)

    1 Reply Last reply
    1
    • V Offline
      V Offline
      VRonin
      wrote on 8 Dec 2017, 08:44 last edited by
      #4

      Just follow the link I posted above to tell VS you want the console out

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      J 1 Reply Last reply 8 Dec 2017, 09:07
      0
      • V VRonin
        8 Dec 2017, 08:44

        Just follow the link I posted above to tell VS you want the console out

        J Offline
        J Offline
        JonB
        wrote on 8 Dec 2017, 09:07 last edited by JonB 12 Aug 2017, 09:10
        #5

        @VRonin / "Lee Van Cleef" :)

        Given that the OP has said "This is a GUI application", how does your link which assumes a console application help him?

        I know nothing about "Win CE7". But it may be that anything written via qDebug() which appears within Visual Studio in its Debug output window will automatically go to whatever Win CE has in the way of a Console window? Has the OP actually just tried existing code under Win CE instead of inside VS? Unless I'm misunderstanding what the OP wishes to achieve....

        V E 2 Replies Last reply 8 Dec 2017, 09:13
        0
        • M Offline
          M Offline
          MikhailG
          wrote on 8 Dec 2017, 09:13 last edited by MikhailG 12 Aug 2017, 09:15
          #6

          You could go in a hard way. Do you familiar with interprocess communication or anonymous pipes or bi directional pipes? Your GUI app could interact with a small console app and display only that stuff you send via one of those approaches. So basicly you would have a GUI app and a console (for debugging purpose) app and the GUI should start the console.

          E 1 Reply Last reply 8 Dec 2017, 09:39
          0
          • J JonB
            8 Dec 2017, 09:07

            @VRonin / "Lee Van Cleef" :)

            Given that the OP has said "This is a GUI application", how does your link which assumes a console application help him?

            I know nothing about "Win CE7". But it may be that anything written via qDebug() which appears within Visual Studio in its Debug output window will automatically go to whatever Win CE has in the way of a Console window? Has the OP actually just tried existing code under Win CE instead of inside VS? Unless I'm misunderstanding what the OP wishes to achieve....

            V Offline
            V Offline
            VRonin
            wrote on 8 Dec 2017, 09:13 last edited by VRonin 12 Aug 2017, 09:17
            #7

            @JNBarchan

            I was referring to:

            • Choose Configuration Properties>Linker>System.
            • For the "Subsystem" property in the right-hand pane, click the drop-down box in the right hand column.
            • Choose "Console (/SUBSYSTEM:CONSOLE)"

            Having the console subsytem does not prevent you from creating Qt widgets.

            @MikhailG Possible but It's like using nuclear bombs to get rid of a bird's nest

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            J 1 Reply Last reply 8 Dec 2017, 09:37
            0
            • J JonB
              8 Dec 2017, 09:07

              @VRonin / "Lee Van Cleef" :)

              Given that the OP has said "This is a GUI application", how does your link which assumes a console application help him?

              I know nothing about "Win CE7". But it may be that anything written via qDebug() which appears within Visual Studio in its Debug output window will automatically go to whatever Win CE has in the way of a Console window? Has the OP actually just tried existing code under Win CE instead of inside VS? Unless I'm misunderstanding what the OP wishes to achieve....

              E Offline
              E Offline
              Ejay
              wrote on 8 Dec 2017, 09:36 last edited by
              #8

              @JNBarchan The said code has been ported and tested on required target module running Win CE7.
              This was done by just changing the right Qt platform.
              1_1512725782911_Screenshot 2.png 0_1512725782910_Screenshot 1.png

              1 Reply Last reply
              0
              • V VRonin
                8 Dec 2017, 09:13

                @JNBarchan

                I was referring to:

                • Choose Configuration Properties>Linker>System.
                • For the "Subsystem" property in the right-hand pane, click the drop-down box in the right hand column.
                • Choose "Console (/SUBSYSTEM:CONSOLE)"

                Having the console subsytem does not prevent you from creating Qt widgets.

                @MikhailG Possible but It's like using nuclear bombs to get rid of a bird's nest

                J Offline
                J Offline
                JonB
                wrote on 8 Dec 2017, 09:37 last edited by JonB 12 Aug 2017, 09:38
                #9

                @VRonin said in Need help for using qDebug() with Qt plugin for Visual Studio 2008:

                @JNBarchan

                Having the console subsytem does not prevent you from creating Qt widgets.

                I was not aware of this. I had thought /SUBSYSTEM:CONSOLE meant no Windows windows at all. I see that it only means create a console as well at startup.

                However, I note that (Visual Studio at least) has /SUBSYSTEM:WINDOWSCE option. If you need that for your app (I don't know), then you can't have the other....

                I will say one thing to the OP about this. If you go for /SUBSYSTEM:CONSOLE it means your app will always open a console. If you compile for release, and your qDebug() statements have no effect, you will still get a console. Is that what you want?

                If not, you have two choices:

                1. Ensure that you have /SUBSYSTEM:CONSOLE only in the Debug configuration, not the Release configuration.
                2. Use Windows ::AllocConsole() to allocate a console, dynamically and as needed or not. This may get you round all the other issues.
                E 1 Reply Last reply 8 Dec 2017, 09:58
                0
                • M MikhailG
                  8 Dec 2017, 09:13

                  You could go in a hard way. Do you familiar with interprocess communication or anonymous pipes or bi directional pipes? Your GUI app could interact with a small console app and display only that stuff you send via one of those approaches. So basicly you would have a GUI app and a console (for debugging purpose) app and the GUI should start the console.

                  E Offline
                  E Offline
                  Ejay
                  wrote on 8 Dec 2017, 09:39 last edited by
                  #10

                  @MikhailG i have started with Qt about 15 days ago, so i better look for a simpler way to serve the purpose :)

                  1 Reply Last reply
                  0
                  • J JonB
                    8 Dec 2017, 09:37

                    @VRonin said in Need help for using qDebug() with Qt plugin for Visual Studio 2008:

                    @JNBarchan

                    Having the console subsytem does not prevent you from creating Qt widgets.

                    I was not aware of this. I had thought /SUBSYSTEM:CONSOLE meant no Windows windows at all. I see that it only means create a console as well at startup.

                    However, I note that (Visual Studio at least) has /SUBSYSTEM:WINDOWSCE option. If you need that for your app (I don't know), then you can't have the other....

                    I will say one thing to the OP about this. If you go for /SUBSYSTEM:CONSOLE it means your app will always open a console. If you compile for release, and your qDebug() statements have no effect, you will still get a console. Is that what you want?

                    If not, you have two choices:

                    1. Ensure that you have /SUBSYSTEM:CONSOLE only in the Debug configuration, not the Release configuration.
                    2. Use Windows ::AllocConsole() to allocate a console, dynamically and as needed or not. This may get you round all the other issues.
                    E Offline
                    E Offline
                    Ejay
                    wrote on 8 Dec 2017, 09:58 last edited by Ejay 12 Aug 2017, 09:59
                    #11

                    @JNBarchan i want the GUI to open up a console and print the debug messages there. In VS the debug messages appear at output window. Similarly while executing by the os i want the console window to show debug messages

                    J 1 Reply Last reply 8 Dec 2017, 11:00
                    0
                    • E Ejay
                      8 Dec 2017, 09:58

                      @JNBarchan i want the GUI to open up a console and print the debug messages there. In VS the debug messages appear at output window. Similarly while executing by the os i want the console window to show debug messages

                      J Offline
                      J Offline
                      JonB
                      wrote on 8 Dec 2017, 11:00 last edited by
                      #12

                      @Ejay

                      Similarly while executing by the os i want the console window to show debug messages

                      @VRonin's of changing the linker option to /SUBSYSTEM:CONSOLE should do this.

                      i want the GUI to open up a console [when running from Visual Studio]

                      Again, the above should do this.

                      In VS the debug messages appear at output window.

                      Yup! Qt's qDebug will, I imagine, go to the "debug window", which VS displays in its Output window. I don't know of/think there is a way to change that behaviour in VS --- at least, not without writing code in "VS extensions" themselves, which is another matter.

                      Your requirement for Visual Studio output of debug lines is "unusual". Unless you/someone else knows better, you may have to settle for the above behaviour while in VS. Does that really matter? If it does, the only other way I can see is for you to cease using qDebug() statements in your code, and use something similar of your own which writes to a "console" explicitly rather than to the debug stream.

                      1 Reply Last reply
                      2

                      12/12

                      8 Dec 2017, 11:00

                      • Login

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