Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QT Executable under Windows
Forum Updated to NodeBB v4.3 + New Features

QT Executable under Windows

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
12 Posts 5 Posters 1.1k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    Korsarq
    wrote on last edited by Korsarq
    #1

    I am statically linking an QT application, but for some reason when i open the executable i am getting errors for missing dlls.

    Basically i am linking the following libs:

    ### LINKER FLAGS ###
    LDFLAGS = -LC:/Qt/5.15.0/mingw81_32/lib
    
    LDLIBS = -lQt5Widgets -lQt5Gui -lQt5Core
    

    Why am i getting errors for missing dlls when i am statically linking everything?

    The compilation and linking passes correctly, the executable is generated also..i have no idea why it needs dlls.

    EDIT:
    Missing dlls :
    libgcc_s_dw2-1.dll,
    libstdc++-6.dll,
    Qt5Code.dll,
    Qt5Widgets.dll

    JonBJ 1 Reply Last reply
    0
    • K Korsarq

      I am statically linking an QT application, but for some reason when i open the executable i am getting errors for missing dlls.

      Basically i am linking the following libs:

      ### LINKER FLAGS ###
      LDFLAGS = -LC:/Qt/5.15.0/mingw81_32/lib
      
      LDLIBS = -lQt5Widgets -lQt5Gui -lQt5Core
      

      Why am i getting errors for missing dlls when i am statically linking everything?

      The compilation and linking passes correctly, the executable is generated also..i have no idea why it needs dlls.

      EDIT:
      Missing dlls :
      libgcc_s_dw2-1.dll,
      libstdc++-6.dll,
      Qt5Code.dll,
      Qt5Widgets.dll

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Korsarq
      Because there are other DLLs. Why don't you actually paste the error message so that people can see which DLLs are being reported?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Korsarq
        wrote on last edited by
        #3

        I added

        -static-libgcc -static-libstdc++

        and now i get errors only for Qt5Code.dll and Qt5Widgets.dll

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Korsarq
          wrote on last edited by
          #4

          I just realized something really strange.The size of the actual executable is surprisingly small - 333kb.How is this possible?I expect to be atleast a few MBs with all those static libraries.

          Pablo J. RoginaP 1 Reply Last reply
          0
          • K Korsarq

            I just realized something really strange.The size of the actual executable is surprisingly small - 333kb.How is this possible?I expect to be atleast a few MBs with all those static libraries.

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by Pablo J. Rogina
            #5

            @Korsarq you may want to take a look at this article.

            And of course, the assumption is that you already have a static version of Qt, right?

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            1
            • K Offline
              K Offline
              Korsarq
              wrote on last edited by
              #6

              I downloaded it from the website prebuild.I think it has both static and dynamic libraries.

              JonBJ J.HilkJ 2 Replies Last reply
              0
              • K Korsarq

                I downloaded it from the website prebuild.I think it has both static and dynamic libraries.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @Korsarq said in QT Executable under Windows:

                I just realized something really strange.The size of the actual executable is surprisingly small - 333kb.How is this possible?I expect to be atleast a few MBs with all those static libraries

                Pretty small! Doesn't sound (to me) like it's a complete static.

                I downloaded it from the website prebuild.I think it has both static and dynamic libraries.

                Are you sure about it having the static libraries you will need?

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  Korsarq
                  wrote on last edited by Korsarq
                  #8

                  I have under C:/Qt/5.15.0/mingw81_32/lib libQt5Widgets.a libQt5Gui.a libQt5Core.a

                  Pablo J. RoginaP 1 Reply Last reply
                  0
                  • K Korsarq

                    I have under C:/Qt/5.15.0/mingw81_32/lib libQt5Widgets.a libQt5Gui.a libQt5Core.a

                    Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #9

                    @Korsarq could you please post your whole project (.pro) file?

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      Korsarq
                      wrote on last edited by
                      #10

                      I don't know what is that .pro file, i am using a makefile.

                      BUILD = Build
                      
                      ### SOURCES ###
                      SRC = Src/Main\
                      	  Src/TlvWindow/TlvWindow
                      
                      ### MOC SOURCES ###
                      MOC_SRC = Src/TlvWindow/TlvWindow
                      
                      ### OBJECTS ###
                      OBJ = $(addsuffix .o, $(addprefix $(BUILD)/, $(SRC))) 
                      OBJ += $(addsuffix .moc.o, $(addprefix $(BUILD)/, $(MOC_SRC)))
                      
                      ### INCLUDES ###
                      INC = -IC:/Qt/5.15.0/mingw81_32/include\
                          -IC:/Qt/5.15.0/mingw81_32/include/Qt3DAnimation\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DCore\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DExtras\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DInput\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DLogic\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DQuick\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DQuickAnimation\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DQuickExtras\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DQuickInput\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DQuickRender\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DQuickScene2D\
                      	-IC:/Qt/5.15.0/mingw81_32/include/Qt3DRender\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtAccessibilitySupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtANGLE\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtBluetooth\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtBodymovin\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtCharts\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtConcurrent\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtCore\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtDataVisualization\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtDBus\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtDesigner\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtDesignerComponents\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtDeviceDiscoverySupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtEdidSupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtEglSupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtEventDispatcherSupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtFbSupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtFontDatabaseSupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtGamepad\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtGui\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtHelp\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtLocation\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtMultimedia\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtMultimediaQuick\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtMultimediaWidgets\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtNetwork\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtNetworkAuth\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtNfc\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtOpenGL\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtOpenGLExtensions\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtPacketProtocol\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtPlatformCompositorSupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtPlatformHeaders\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtPositioning\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtPositioningQuick\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtPrintSupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtPurchasing\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQml\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQmlDebug\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQmlModels\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQmlWorkerScript\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuick\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuick3D\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuick3DAssetImport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuick3DRender\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuick3DRuntimeRender\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuick3DUtils\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuickControls2\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuickParticles\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuickShapes\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuickTemplates2\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuickTest\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtQuickWidgets\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtRemoteObjects\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtRepParser\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtScript\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtScriptTools\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtScxml\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtSensors\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtSerialBus\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtSerialPort\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtSql\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtSvg\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtTest\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtTextToSpeech\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtThemeSupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtUiPlugin\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtUiTools\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtVirtualKeyboard\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtWebChannel\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtWebSockets\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtWidgets\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtWindowsUIAutomationSupport\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtWinExtras\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtXml\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtXmlPatterns\
                      	-IC:/Qt/5.15.0/mingw81_32/include/QtZlib\
                      	-ISrc/TlvWindow
                      
                      ### LINKER FLAGS ###
                      LDFLAGS = -static -LC:/Qt/5.15.0/mingw81_32/lib
                      
                      LDLIBS = C:/Qt/5.15.0/mingw81_32/lib/libQt5Widgets.a\
                               C:/Qt/5.15.0/mingw81_32/lib/libQt5Gui.a\
                               C:/Qt/5.15.0/mingw81_32/lib/libQt5Core.a\
                      		 -static-libgcc -static-libstdc++
                      		  
                      ### COMPILER FLAGS
                      CFLAGS = $(INC)
                      
                      ### COMPILER ###
                      CC = g++
                      
                      ### QT MOC ###
                      MOC = moc
                      
                      all: $(BUILD)/test.exe
                      
                      $(BUILD)/test.exe: $(OBJ)
                      	@echo LINKING $^
                      	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
                      	
                      $(BUILD)/%.o: %.cpp
                      	@echo COMPILING $<
                      	@mkdir -p $(subst /,\,$(dir $@))
                      	@$(CC) $(CFLAGS) -M -MT $@ -o $(patsubst %.o, %.d, $@) $<
                      	@$(CC) $(CFLAGS) -o $@ -c $<
                      
                      $(BUILD)/%.moc.o: $(BUILD)/%.moc.cpp
                      	@echo COMPILING MOC $<
                      	@mkdir -p $(subst /,\,$(dir $@))
                      	@$(CC) $(CFLAGS) -M -MT $@ -o $(patsubst %.o, %.d, $@) $<
                      	@$(CC) $(CFLAGS) -o $@ -c $<
                      					    
                      $(BUILD)/%.moc.cpp: %.h
                      	@echo GENERATING MOC $<
                      	@$(MOC) $< -o $@
                      
                      -include $(OBJ:.o=.d) 
                      	
                      .PHONY: clean
                      
                      clean:
                      	@echo CLEANING......
                      	@rm -rf $(BUILD)/Src $(BUILD)/test.exe
                      
                      
                      1 Reply Last reply
                      0
                      • foxomanF Offline
                        foxomanF Offline
                        foxoman
                        wrote on last edited by foxoman
                        #11

                        Fully Static build will be almost 30 Mb without stripping.

                        .pro file the is QtCreator project file which you could generate and execute using qmake build, which you could find it in /Qt/5.15.0/mingw81_32/bin as per your path.

                        You should build and handle everything with qmake which will generate the correct makefile.

                        Add also: CONFIG += release static to your .pro file.

                        As we are not sure how did you install Qt and if its actually support the static build. For a better build environment, I would suggest using msys2 which will install a complete qt with static and dynamic with QtCreator with the update and full package management.

                        Tech Addict, Ubuntu Gnu/Linux Fan and Qt/C++ Developer. || https://www.foxoman.net/

                        1 Reply Last reply
                        0
                        • K Korsarq

                          I downloaded it from the website prebuild.I think it has both static and dynamic libraries.

                          J.HilkJ Offline
                          J.HilkJ Offline
                          J.Hilk
                          Moderators
                          wrote on last edited by
                          #12

                          @Korsarq said in QT Executable under Windows:

                          I downloaded it from the website prebuild.I think it has both static and dynamic libraries.

                          from what website, qt.io ?
                          Those are only dynamically linked (for legal reasons I assume). Usually one has to build Qt him/herself when one want to make a static qt app


                          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                          Q: What's that?
                          A: It's blue light.
                          Q: What does it do?
                          A: It turns blue.

                          1 Reply Last reply
                          1

                          • Login

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