Results 1 to 6 of 6

Thread: console always popup in release mode

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: console always popup in release mode

    Hi,

    I believe the problems was there. This is why I display a MessageBox. But even in Debug or in Release argc==1 (and I display it in message box).

    This code is running well if I launch from QTCreator in debug and Release mode.

    But I launch it directly from the exe I have always the console present

    Any other Idea?

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: console always popup in release mode

    Because QTCreator put some args to application ? Line 25 detects if You have some args (argc > 1) or not. If You want to run application with exactly one argument line 25 should be :
    Qt Code:
    1. if(argc == 2)
    To copy to clipboard, switch view to plain text mode 
    BTW it is better use of QCoreApplication::arguments.

  3. #3

    Default Re: console always popup in release mode

    Ok please don't focus on number of arg !!!
    If I use this code :
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4.  
    5. FlashLoader w;
    6.  
    7. w.show();
    8. return a.exec();
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 
    and in my pro file
    Qt Code:
    1. CONFIG += console
    To copy to clipboard, switch view to plain text mode 

    If I run in Debug or Release mode through QTcreator I have no console open

    If I run directly the exe, I have always console present

  4. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: console always popup in release mode

    Hi,

    You can use "--console" as argument to your application. In "main.cpp" you have to search if there is "--console" in some of the arguments. If you find it you can open your application as console and if you don't find it open as GUI.
    Òscar Llarch i Galán

Similar Threads

  1. Replies: 1
    Last Post: 7th March 2012, 21:34
  2. Replies: 11
    Last Post: 19th August 2010, 13:14
  3. Replies: 1
    Last Post: 2nd November 2009, 12:02
  4. Replies: 9
    Last Post: 15th April 2009, 06:23
  5. Replies: 8
    Last Post: 10th October 2007, 18:20

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
  •  
Qt is a trademark of The Qt Company.