My C(++) program, written and compiled using Visual C(++)/Visual Studio, runs fine on my own machine, but refuses to run on another machine. The error message I get is "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."
C++ – Visual C++/Studio: Application configuration incorrect
cvisual c++visual studio
Related Topic
- Git – .gitignore for Visual Studio Projects and Solutions
- Visual-studio – Difference between Build Solution, Rebuild Solution, and Clean Solution in Visual Studio
- Visual-studio – Error ‘LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt’ after installing Visual Studio 2012 Release Preview
- Asp.net-mvc – Visual Studio debugging/loading very slow
- C++ – Problems with running EXE file built with Visual Studio on another computer
- C# – How to fix the Microsoft Visual Studio error: “package did not load correctly”
- Visual-studio – Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state
Best Answer
If you write a C++ program, it links dynamically to the C Runtime Library, or CRT for short. This library contains your printf, your malloc, your strtok, etcetera. The library is contained in the file called MSVCR80.DLL. This file is not by default installed on a Windows system, hence the application cannot run.
The solution? Either install the DLL on the target machine through VCREDIST.EXE (the Visual C++ Redistributable Package), or link to the CRT statically (plug the actual code for the used functions straight into your EXE).
Distributing and installing VCREDIST along with a simple application is a pain in the arse, so I went for the second option: static linking. It's really easy: go to your project's properties, unfold C/C++, click Code Generation, and set the Runtime Library to one of the non-DLL options. That's all there is to it.