Results 1 to 13 of 13

Thread: how to avoid command prompt while reunning EXE ?

  1. #1
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up how to avoid command prompt while reunning EXE ?

    Hi all,

    I created GUI Application Exe . If I run the exe . One command prompt is comming with

    this in Windows. How to avoid this Command prompt window ?
    Thanks,
    Rajesh.S

  2. #2
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to avoid command prompt while reunning EXE ?


  3. #3
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: how to avoid command prompt while reunning EXE ?

    I am using VS compiler
    Thanks,
    Rajesh.S

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

    Default Re: how to avoid command prompt while reunning EXE ?

    Do you use a .pro file? If so, remove CONFIG+=console from it. If not, access your Qt VS integration module and disable the console there.

  5. #5
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to avoid command prompt while reunning EXE ?

    I am using cmake to compile my application .
    Thanks,
    Rajesh.S

  6. #6
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to avoid command prompt while reunning EXE ?

    Then read cmake ml or documentation

    http://www.cmake.org/pipermail/cmake...ch/020572.html

  7. #7
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: how to avoid command prompt while reunning EXE ?

    I added WIN32 in ADD_EXECUTABLE of CMake


    But I am getting the following error,


    error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup


    Thanks,
    Rajesh.S

  8. #8
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to avoid command prompt while reunning EXE ?

    Did you forgot to add QT_QTMAIN_LIBRARY to target_link_libraries ?

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

    Default Re: how to avoid command prompt while reunning EXE ?

    Make clean (or at least delete main.o) and rebuild. Sources haven't changed so you need to force a rebuild by hand.
    J-P Nurmi

  10. #10
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to avoid command prompt while reunning EXE ?

    I did clean and then build ,still i am getting same error.

    I am suspecting my main implementation,

    i am using main like below,

    Qt Code:
    1. int main(int argc,char* argv[])
    2. {
    3. QApplication myApp(argc,argv);
    4.  
    5. MyMainWindow mainWnd;
    6.  
    7. mainWnd.show();
    8.  
    9. return myApp.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    MyMainWindow is derived from QMainWindow.

    Is my main implementation correct ?
    Last edited by wysota; 26th March 2008 at 09:11. Reason: missing [code] tags
    Thanks,
    Rajesh.S

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

    Default Re: how to avoid command prompt while reunning EXE ?

    Yes, it's fine. Your project file has to be incorrect.

  12. #12
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: how to avoid command prompt while reunning EXE ?

    Now I solved by adding following Lines in the CMakeLists.txt File.

    IF(WIN32)
    LINK_LIBRARIES(
    ${QT_QTMAIN_LIBRARY}
    )
    ENDIF(WIN32)

    IF(WIN32)
    ADD_DEFINITIONS(-DQT_DLL)
    ENDIF(WIN32)



    and then ,

    WIN32 in ADD_EXUCUTABLE
    Thanks,
    Rajesh.S

  13. #13
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to avoid command prompt while reunning EXE ?

    No need to add this for WIN32 only. ${QT_QTMAIN_LIBRARY} is just empty on linux and QT_DLL is ignored (why do you need it at all?)

  14. The following user says thank you to ChristianEhrlicher for this useful post:

    rajeshs (27th March 2008)

Tags for this Thread

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.