Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Remove console
QtWS25 Last Chance

Remove console

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 5.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lloydqt
    wrote on last edited by
    #1

    Hi,

    I am building a Qt application In Windows using VisualStudio 2013, Qt 5.3 and CMake. In release mode I wish to hide the console Window. What is the right way to do that.

    I have checked different options, One was to change "main" to "WinMain" and change the subsystem to "Windows" from "Console". But the samples in Qt uses main, and i believe main is the right entry point to use.

    What is the correct way?

    Thanks a lot in Advance,
    Lloyd

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Is your application a console application or a widget application?
      If it is a widget application then remove CONFIG += console in your PRO file.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lloydqt
        wrote on last edited by
        #3

        Its a Widget application.

        What I understood from your reply is to remove the subsystem "CONSOLE". Then it will throw an error unresolved external symbol "WinMain" as "main" is my entry point!

        If I write WinMain the code won't be portable!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          IIRC, you need add set(GUI_TYPE WIN32) to your pro file.

          Hope it helps

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • L Offline
            L Offline
            lloydqt
            wrote on last edited by
            #5

            In cmake file i was using

            ADD_EXECUTABLE(MyExec ${MYEXEC_SRC} )

            The problem is solved when I changed it to

            ADD_EXECUTABLE(MyExec WIN32 ${MYEXEC_SRC} )

            1 Reply Last reply
            2
            • L Offline
              L Offline
              lloydqt
              wrote on last edited by
              #6
              This post is deleted!
              RatzzR 1 Reply Last reply
              0
              • L lloydqt

                This post is deleted!

                RatzzR Offline
                RatzzR Offline
                Ratzz
                wrote on last edited by
                #7

                @lloydqt
                Use the Topic Tools button to mark as Solved.

                --Alles ist gut.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved