Results 1 to 9 of 9

Thread: where is cout in Qt Creator

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2017
    Posts
    23
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: where is cout in Qt Creator

    it depending on what is the type of your app, console app or gui app. if it was console it would be appeared on console application but if you were using a gui, it should be appeared in the application output only when using
    qDebug()<<"hello world";

  2. #2
    Join Date
    Sep 2019
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: where is cout in Qt Creator

    Hello,

    I've been using Qt4 and C++ for making programs in computer graphics, now switching to Gt5. How can I use 'cout' to print the variables in the console at run-time? It doesn't work, even when I add the libraries. Here's the error message: error: ‘cout’ was not declared in this scope



    https://stackoverflow.com/questions/3886105/how-to-print-to-console-when-using-qt https://writemyessaytoday.net/write-my-essay-in-6-hours https://www.qtcentre.org/threads/33506-where-is-cout-in-Qt-Creator

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: where is cout in Qt Creator

    cout is declared in the C++ Standard Library. You need to #include <iostream> and preface cout with the std:: scope:

    Qt Code:
    1. std::cout << "Hello world!" <<std::endl;
    To copy to clipboard, switch view to plain text mode 

    Or (bad practice) add a "using namespace std;" declaration after including iostream.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. where is cout
    By hqking1988 in forum General Programming
    Replies: 3
    Last Post: 22nd August 2010, 03:35
  2. QProcess : force cout to be sent
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 5th April 2007, 23:05
  3. cout problem
    By mickey in forum General Programming
    Replies: 3
    Last Post: 2nd March 2007, 18:12
  4. How to cout in Qt ?
    By probine in forum Qt Programming
    Replies: 4
    Last Post: 15th December 2006, 00:47
  5. std::cout displaying a hex value instead of a string.
    By johnny_sparx in forum Qt Programming
    Replies: 2
    Last Post: 8th April 2006, 08:55

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.