Problem statement

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.

Folder structure

For the majority of dll files, the rule is pretty simple: they must be placed same folder where the binary is.

OSG plugins

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 bin directory.

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:

Qt plugins

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

Other library files

This is the list of other dll files that may be necessary to run a Qt executable:

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 exe folder:

Structure

Edit

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:

Both of these files are located at C:/Windows/SysWOW64/.