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. Why when running .exe file has 2 windows pop up
Forum Updated to NodeBB v4.3 + New Features

Why when running .exe file has 2 windows pop up

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 4 Posters 572 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.
  • DQUY05D Offline
    DQUY05D Offline
    DQUY05
    wrote on last edited by
    #1

    Hi,

    I run the application for desktop, when I run it on Qt IDE, there is no problem, but when I run the .exe file directly (or build with inno to run on another computer), two windows appear, I don't know what is this black window (win1),
    While my other apps are normal
    Please help everyone

    Many thanks !

    ![alt text](14770898-e22d-49e8-8f50-d48b84767a26-image.png image url)
    ![alt text](d8ce4f5f-20d1-4d65-84bd-ef0d38861010-image.png image url)

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Looks like you have CONFIG += console in your pro file

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      DQUY05D 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Looks like you have CONFIG += console in your pro file

        DQUY05D Offline
        DQUY05D Offline
        DQUY05
        wrote on last edited by
        #3

        @Christian-Ehrlicher said in Why when running .exe file has 2 windows pop up:

        Looks like you have CONFIG += console in your pro file

        Dear Sir,

        This is my .pro file, absolutely no CONFIG += console

        Thanks !

        QT += core gui
        QT += testlib
        QT += multimedia multimediawidgets
        QT += printsupport
        
        CONFIG += staticlib
        CONFIG += qzxing_qml
        CONFIG += qzxing_multimedia
        include(QZxing-master/src/QZXing.pri)       # copy folder QZxing-master vào thư mục project của bạn
        
        RC_ICONS = vst1.ico
        
        INCLUDEPATH +=C:/SETUP/OPENCV/OpenCV-MinGW-Build-OpenCV-4.1.0/include
        LIBS += C:/SETUP/OPENCV/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_core410.dll
        LIBS += C:/SETUP/OPENCV/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_highgui410.dll
        LIBS += C:/SETUP/OPENCV/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_imgproc410.dll
        LIBS += C:/SETUP/OPENCV/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_videoio410.dll
        LIBS += C:/SETUP/OPENCV/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_imgcodecs410.dll
        LIBS += C:/SETUP/OPENCV/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_features2d410.dll
        LIBS +=C:/SETUP/OPENCV/OpenCV-MinGW-Build-OpenCV-4.1.0/x86/mingw/bin/libopencv_video410.dll
        
        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
        
        CONFIG += c++11
        
        SOURCES += \
            main.cpp \
            mainwindow.cpp
        
        HEADERS += \
            mainwindow.h
        
        FORMS += \
            mainwindow.ui
        
        # Default rules for deployment.
        qnx: target.path = /tmp/$${TARGET}/bin
        else: unix:!android: target.path = /opt/$${TARGET}/bin
        !isEmpty(target.path): INSTALLS += target
        
        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @DQUY05 said in Why when running .exe file has 2 windows pop up:

          QZXing.pri

          Maybe in there.

          You can remove a config option with

          CONFIG -= debug

          Add this just before your SOURCES +=

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          DQUY05D 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @DQUY05 said in Why when running .exe file has 2 windows pop up:

            QZXing.pri

            Maybe in there.

            You can remove a config option with

            CONFIG -= debug

            Add this just before your SOURCES +=

            DQUY05D Offline
            DQUY05D Offline
            DQUY05
            wrote on last edited by
            #5

            @Christian-Ehrlicher

            Thank Sir !

            I don't speak English well, am I doing this right, it still doesn't work

            QT += core gui
            QT += testlib
            QT += multimedia multimediawidgets
            QT += printsupport
            
            CONFIG += staticlib
            CONFIG += qzxing_qml
            CONFIG += qzxing_multimedia
            CONFIG -= debug
            include(QZxing-master/src/QZXing.pri)
            
            Christian EhrlicherC 1 Reply Last reply
            0
            • DQUY05D DQUY05

              @Christian-Ehrlicher

              Thank Sir !

              I don't speak English well, am I doing this right, it still doesn't work

              QT += core gui
              QT += testlib
              QT += multimedia multimediawidgets
              QT += printsupport
              
              CONFIG += staticlib
              CONFIG += qzxing_qml
              CONFIG += qzxing_multimedia
              CONFIG -= debug
              include(QZxing-master/src/QZXing.pri)
              
              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @DQUY05 As I already said maybe CONFG += console is added in QZXing.pri, so removing it before including the pri-file will not help at all...

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              DQUY05D 1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                @DQUY05 As I already said maybe CONFG += console is added in QZXing.pri, so removing it before including the pri-file will not help at all...

                DQUY05D Offline
                DQUY05D Offline
                DQUY05
                wrote on last edited by
                #7

                @Christian-Ehrlicher

                Dear Sir,

                Even if I don't use QZXing, the error is still the same
                Could it be due to another reason?

                Thanks !

                #CONFIG += staticlib
                #CONFIG += qzxing_qml
                #CONFIG += qzxing_multimedia
                #include(QZxing-master/src/QZXing.pri)
                
                1 Reply Last reply
                0
                • hskoglundH Offline
                  hskoglundH Offline
                  hskoglund
                  wrote on last edited by
                  #8

                  Hi, if you build it for Release (not Debug) do you still get 2 windows?

                  DQUY05D 1 Reply Last reply
                  0
                  • hskoglundH hskoglund

                    Hi, if you build it for Release (not Debug) do you still get 2 windows?

                    DQUY05D Offline
                    DQUY05D Offline
                    DQUY05
                    wrote on last edited by
                    #9

                    @hskoglund

                    Yes Sir,

                    ![alt text](f09493b5-39e0-43ee-b8bb-dea737a94df7-image.png image url)

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      Bonnie
                      wrote on last edited by Bonnie
                      #10

                      That's probably because that QT += testlib
                      Qt test should only be used in unit testing, not in real application.

                      DQUY05D 1 Reply Last reply
                      5
                      • B Bonnie

                        That's probably because that QT += testlib
                        Qt test should only be used in unit testing, not in real application.

                        DQUY05D Offline
                        DQUY05D Offline
                        DQUY05
                        wrote on last edited by
                        #11

                        @Bonnie
                        Thank Sir,

                        indeed it was caused by QT += testlib, I'm glad the problem is solved

                        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