In this tutorial we will look at how to quickly assemble a binary that can be run on another machine. As an example, assume: your friend would like to give a quick test of your software on their machine. For this purpose, it does not make much sense for your friend to spend time and effort into compiling your code from source (which also means libraries installation and environment setup), but rather to use already compiled executable of your program. One of the biggest assumption is that both of yours and friend’s machines have the same Windows version and platform.
If you use Qt and OpenSceneGraph for development of your software, you would have to join a bunch of files to accompany your executable. Those files are called libraries and have an extension of
.dll. If you ever encountered an error which says
dll cannot be found when you run any program, it means some libraries are missing.
I am going to provide a list of some
dll files that will most probably be useful for any Qt + OpenSceneGraph project, as well as an example of the folder structure where you place your binary. With all that, it is straightforward to copy the necessary files and then run an executable of quite sophisticated program.
For the majority of
dll files, the rule is pretty simple: they must be placed same folder where the binary is.
If you use some plugins, for example, your program uses OSG plugins to read third-party files, or Qt plugins to display icons, you have to create a plugin folder with the same name as in the
Much easier to see it on an example: assume you are using some serialization plugins of OSG. Your program will not function properly without the necessary plugins, so you have to copy them:
- first, go to the OSG installation folder
- from the root installation folder, go to
- there you will notice a plugin folder, e.g.
\osgPlugins-3.4.0; create folder with the same name at your executable folder
- copy the necessary
dllfiles; to be safe I always copy all the
dllfiles from plugin folder
Same principle follows any Qt plugins that you use. Normally, the Qt’s plugins are located at
$QT_ROOT_PATH/plugins/used_plugin_folder. For example,
imageformats contain libraries to read different image file formats. If you use any plugin from
imageformats folder, you need to create a folder
imageformats in the directory of your executable and then copy the necessary
Other library files
This is the list of other
dll files that may be necessary to run a Qt executable:
- library files of folder
$QT_ROOT_PATH/plugins/platformswhich need to be copied to the corresponding
platformsfolder of executable directory
- libraries such as
icuuc53.dll(the number at the end can differ) - located at the
bindirectory of Qt root folder
lib*GL*.dlland other OpenGL-related files that can be found in
bindirectory of Qt root folder
A folder structure example
After I assembled a folder for an executable of my CAD-like program, these are some files that ended up in my
As I found out later, that list is not complete in case if there is no Visual Studio installed. Depending on the MSVC version which was used for compillation, the next files are needed to be added to the root folder:
XYZdenotes a number, for example
msvcp140.dllfor Visual Studio 2013
VCRuntimeXYZ.dllwith the same
Both of these files are located at