Results 1 to 5 of 5

Thread: How to cout in Qt ?

  1. #1
    Join Date
    Jan 2006
    Posts
    185
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to cout in Qt ?

    I want to print messages in the console in Windows.

    How do I do it with cout << ?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to cout in Qt ?

    Check this thread.
    J-P Nurmi

  3. #3
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to cout in Qt ?

    Quote Originally Posted by probine View Post
    I want to print messages in the console in Windows.

    How do I do it with cout << ?
    Try qDebug( ) instead.

  4. #4
    Join Date
    Oct 2006
    Location
    Raleigh, NC
    Posts
    11
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Re: How to cout in Qt ?

    This is a cool trick I learned from someone on the forums. Assuming you're using Visual Studio, if you go to the Project Properties and set configuration properties>Linker>System>SubSystem to "Console" your application will show a console and cout << will be displayed in the console. I usually use this for my debug project and return the subsystem to windows for my release projects.

    HTH
    Hua-Ying

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to cout in Qt ?

    Quote Originally Posted by hyling View Post
    This is a cool trick I learned from someone on the forums. Assuming you're using Visual Studio, if you go to the Project Properties and set configuration properties>Linker>System>SubSystem to "Console" your application will show a console and cout << will be displayed in the console. I usually use this for my debug project and return the subsystem to windows for my release projects.
    This is equivalent of writing:

    win32 {
    release:CONFIG -= console
    debug:CONFIG += console
    }
    in the project file.

Similar Threads

  1. Iostream cout on loop same line
    By patrik08 in forum General Programming
    Replies: 3
    Last Post: 7th December 2006, 13:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.