Visual Studio 2005 or later problems and solutions

By Arne Vidstrom

May 15, 2019

There are a couple of problems that can occur when you compile your programs with Visual Studio 2005 or later. This is still relevant to Visual Studio 2019.

Problem: When running a program compiled with Visual Studio 2005 or later one of the following error messages appears: "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem" or "The system cannot execute the specified program."

Cause and solution: This problem occurs when a program compiled with Visual Studio is run on a computer without Visual Studio installed. One solution is to distribute necessary files from "C:\Program Files\Microsoft Visual Studio 8\VC\redist\" together with the program (the exact path depends on the version). Another solution is to change the linking of the runtime library. In the project properties go to Configuration Properties - C/C++ - Code Generation - Runtime Library. Change the setting from Multi-threaded DLL (/MD) to Multi-threaded (/MT) and then rebuild the project.

Problem: When running a program compiled with Visual Studio 2005 or later, some Win32 API calls fail without apparent reason.

Cause and solution: This problem occurs with Win32 API calls that take text strings as parameters because the project default is to link against the Unicode version of the API (for example LoadLibraryW instead of LoadLibraryA). To solve the problem, open the project properties dialog. From there, expand Configuration Properties, select General, and change Character Set from "Use Unicode Character Set" to "Use Multi-Byte Character Set."