Results 1 to 4 of 4

Thread: I want to write to console

  1. #1
    Join Date
    Nov 2012
    Posts
    232
    Thanks
    118
    Thanked 18 Times in 10 Posts
    Platforms
    Windows Android

    Default I want to write to console

    Hi,

    I build my application how "release" and add all .dll's. When I run my application from console I don't see ouput:

    Qt Code:
    1. #include <QGLFormat>
    2. #include <QGLWidget>
    3. #include <QString>
    4. #include <iostream>
    5. #include <QApplication>
    6.  
    7. int main( int argc, char *argv[] )
    8. {
    9. QApplication app( argc, argv );
    10.  
    11. std::cout << "Hello" << std::endl;
    12. fflush(stdout);
    13.  
    14. QGLFormat format;
    15. format.setVersion( 4, 3 );
    16. QGLFormat::setDefaultFormat( format );
    17.  
    18. w.makeCurrent();
    19.  
    20. QString vendor( QLatin1String( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
    21. std::cout << "Vendor: " << vendor.toStdString() << std::endl;
    22.  
    23. QString renderer( QLatin1String( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
    24. std::cout << "Renderer: " << renderer.toStdString() << std::endl;
    25.  
    26. QString versionOfGL( QLatin1String(reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
    27. std::cout << "Version: " << versionOfGL.toStdString() << std::endl;
    28.  
    29. QString versionGLSL( QLatin1String(reinterpret_cast<const char*>( glGetString( GL_SHADING_LANGUAGE_VERSION ) ) ) );
    30. std::cout << "GLSL: "<< versionGLSL.toStdString() << std::endl;
    31.  
    32. return app.exec();
    33. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: I want to write to console

    Since you wrote .dll I assume you are on Windows.
    Have you added
    Qt Code:
    1. CONFIG += console
    To copy to clipboard, switch view to plain text mode 
    to your .pro file?

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    8Observer8 (7th August 2014)

  4. #3
    Join Date
    Nov 2012
    Posts
    232
    Thanks
    118
    Thanked 18 Times in 10 Posts
    Platforms
    Windows Android

    Default Re: I want to write to console

    Yes, it works but very long in first time


    Added after 16 minutes:


    It is not problem. Thank you!

    I have Asus X53S. When I run this application I see:
    Vendor: Intel
    Renderer: Intel(R) HD Graphics Family
    Version: 3.0.0 - Build 8.15.10.2291
    GLSL: 1.30 - Intel Build 8.15.10.2291
    When I right click on .exe and select "Run with graphics processor" -> "High-performence NVIDIA processor" I see:
    Vendor: NVIDIA Corporation
    Renderer: GeForce GT 540M/PCI/SSE2
    Version: 4.1.0
    GLSL: 4.10 NVIDIA via Cg compiler
    How to check second variant for Qt by default?
    Last edited by 8Observer8; 7th August 2014 at 19:21.

  5. #4
    Join Date
    Nov 2012
    Posts
    232
    Thanks
    118
    Thanked 18 Times in 10 Posts
    Platforms
    Windows Android

    Default Re: I want to write to console

    Changing graphics processor depends on OS

Similar Threads

  1. Write a console app to test two classes
    By Losh in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2014, 01:40
  2. How to write a Russian text in console?
    By 8Observer8 in forum Newbie
    Replies: 28
    Last Post: 17th February 2014, 08:38
  3. Read/Write console app
    By InterFiction in forum Newbie
    Replies: 1
    Last Post: 15th November 2011, 14:00
  4. Replies: 7
    Last Post: 13th September 2011, 13:15
  5. How to write qt4 gui up to the existing console
    By binaural in forum Qt Programming
    Replies: 4
    Last Post: 16th June 2009, 13:44

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.