GigaCoders

Learn. Share. Code

Full width home advertisement

CPP Basics Live Series

Using the Qt Creator

Post Page Advertisement [Top]

So you've built your Qt project application and want to share the executable file for others to run without having them install Qt on their computer. The process to do this is very simple as you will learn and I also include a fix for a "missing .dll files" issue that may arise. With that said, let's begin...


I am using a Windows 10 laptop running Qt 6.3.0. Also, if you wish to skip this reading, here is a video I found on YouTube that shows this entire process, as well as how to create an installer for your project. Here is the video link: https://youtu.be/hCXAgB6y8eA


Step 1: Switch from Debug Mode to Release Mode

After opening a project, above the run button there should be another that reads "Debug". Upon clicking it, you'll see the project details with options to switch to Profile and Release. Click on release and then click the run button. In your project folder you should see another folder named similarly to the build folder except it will have the word "Release" at the end of its name instead of "Debug".


Step 2: Enter the release folder 

In your project folder, enter the "Release" folder that was just built and enter the directory named "release" - note the naming of these folders. Your directory location should look like what I have in the picture below. 


Step 3: Delete all Files except the .exe file in the "release" folder you are currently in.

 It should be name something like "yourprojectname.exe". You may also skip deleting these files and simply copy the .exe file to another directory location that you would like to have this project's necessary files built (like in a folder in the documents/desktop etc.). 


Step 4: Open MinGW

Find the MinGW app that corresponds with the compiler you are using for your project. As seen below, I am using Qt 6.3.0 (MinGW 11.2.0 64-bit).


Step 5: Set the directory location of the .exe file

Copy the directory location of your .exe file. In MinGW, type cd and paste the directory location you copied.


Step 6: Build the necessary files in the directory location

Type "windeployqt yourprojectname.exe" in MinGW and press Enter. Obviously you must replace yourprojectname with your own project name. Next just simply wait until the process is done. After it is done, you may run the .exe file of your project. If you plan to share it around, ZIP the folder that holds the executable and that can be shared. The executable will only work if it is in the folder with the rest of files that you just built.

The below picture shows an example of what you should have in MinGW before clicking Enter.


The below picture shows the files that were built alongside your executable file.


MISSING .DLL FILES  POTENTIAL FIX

If you do not have any of the files in the red brackets seen in the picture below, you can download them from my google drive using the links below the picture and move them to the folder with your executable.






If you have more .dll files missing then you may need to do some further research. Dependency Walker was brought to my attention by one of my classmates and it was mentioned to be able to know and include all files necessary to run the executable. I have not tried this method before so I cannot tell if works. 

Thanks for reading

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib