# Problem

When using mingw-64 to compile programs, it usually comes with lots of dlls in dependencies. Moreover, these dlls are placed inside the installation path, inside mingw32/bin for 32-bit dlls and mingw64/bin for 64-bit dlls. When I want to share my program with my friends, I usually need to packing the dlls with the exe. So I need to collect the dlls by hand which bothers me a lot.

Open the program and see the error message and then copy the dlls to folder. Sometimes the error message doesn’t even tell the dll name, only with some vague error message that I need to google myself.

# Solution

Use ListDLLs to list all the dlls which our program depends on.

To list the dlls of a program, run the following command:

The dlls which path starts with mingw are the dlls we want.

The result has some dlls that we don’t care, we can use some cli tools to sort the output for better format.

Then just copy the dlls and place them aside the exe file.