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 570 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.
  • D Offline
    D Offline
    DQUY05
    wrote on 13 Jan 2023, 07:57 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
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 13 Jan 2023, 08:01 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

      D 1 Reply Last reply 13 Jan 2023, 08:16
      0
      • C Christian Ehrlicher
        13 Jan 2023, 08:01

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

        D Offline
        D Offline
        DQUY05
        wrote on 13 Jan 2023, 08:16 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
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 13 Jan 2023, 08:21 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

          D 1 Reply Last reply 13 Jan 2023, 08:39
          0
          • C Christian Ehrlicher
            13 Jan 2023, 08:21

            @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 +=

            D Offline
            D Offline
            DQUY05
            wrote on 13 Jan 2023, 08:39 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)
            
            C 1 Reply Last reply 13 Jan 2023, 08:40
            0
            • D DQUY05
              13 Jan 2023, 08:39

              @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)
              
              C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 13 Jan 2023, 08:40 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

              D 1 Reply Last reply 13 Jan 2023, 08:50
              0
              • C Christian Ehrlicher
                13 Jan 2023, 08:40

                @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...

                D Offline
                D Offline
                DQUY05
                wrote on 13 Jan 2023, 08:50 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 Online
                  hskoglundH Online
                  hskoglund
                  wrote on 13 Jan 2023, 09:16 last edited by
                  #8

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

                  D 1 Reply Last reply 13 Jan 2023, 09:23
                  0
                  • hskoglundH hskoglund
                    13 Jan 2023, 09:16

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

                    D Offline
                    D Offline
                    DQUY05
                    wrote on 13 Jan 2023, 09:23 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 13 Jan 2023, 09:23 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.

                      D 1 Reply Last reply 13 Jan 2023, 09:33
                      5
                      • B Bonnie
                        13 Jan 2023, 09:23

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

                        D Offline
                        D Offline
                        DQUY05
                        wrote on 13 Jan 2023, 09:33 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

                        1/11

                        13 Jan 2023, 07:57

                        • Login

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