The application was unable to start correctly (or failed to initialize properly)

When one of the following error messages is shown after executing an application:

  • The application was unable to start correctly (0xc<7 hexadecinal digits>). Click OK to terminate the application.
  • The application failed to initialize properly (0xc<7 hexadecinal digits>). Click OK to terminate the application.

there is no information about what is the real problem. It may get more mystic if you are developing the application. You will try to debug it without success, since the same error will appear in Visual Studio, or any other IDE, and the first line of code in your main function is not reached. The application really can’t start.

This error usually means that a shared library (dll) is missing. If the missing shared library is a direct (first level) dependency, the error is different and informative (The program can’t start because XXXXXX.dll is missing from your computer). However, if a shared library calls another shared library, the former and obscure error will be displayed instead.

The solution: download the Dependency Walker application, and run it with your application executable to find the missing shared library file name. Once you know the file name, google it, find and download the prerequisite that contains the library, and install it.

Take into account that:

  1. The shared library version matters. If you install a different prerequisite version than the one originally used for compiling the calling shared library, the error may be still thrown. Therefore, you may try more than one version until you find the right one.
  2. Do not download single dll files from untrusted sites, since there is no guarantee that those files are untouched.

Real case scenario: your application uses some third-party shared libraries as black boxes (you don’t have the source code). Someone updates one of these third-party libraries at the common repository, and the updated library has a new dependency. When you update your local copy, compile and execute, you will find the error.

P.S.: In Spanish, the errors are translated as “La aplicación no se ha podido inicializar correctamente (0xc<7 dígitos hexadecimales>)” and “El programa no puede iniciarse porque falta XXXXXX.dll en el equipo”.

Advertisements