tags:

views:

97

answers:

4

Hi,

I wrote a simple 'Hello, world' application in C++ using Visual Studio 2008. I am able to run the app successfully on my local machine. BUt when I copy the exe onto another machine and run, it does not run. It gives the error that 'Application has failed to start because application configuration is incorrect'. The another system does not have Visual Studio installed. What could be the problem?

Thanks, Rakesh.

+5  A: 

Probably the CRT DLL is missing. Compile your app using static CRT - /MT (/MTd for debug). More info.

In Visual studio go to Project properties > C/C++ > Code Generation > Runtime Library.

Igor Zevaka
+4  A: 

I think you need

1) To install Microsoft Visual C++ 2008 Redistributable Package (x86)

2) Read about manifests and deployment of C++ applications: Scenarios for Deployment Examples, Choosing a Deployment Method

skwllsp
been there.. Redistributable package only works for the Release configuration as well (not the Debug configuration).
Default
@Michael in that case, build in in Release. If the debug libraries are not in the redistributable package, then they are not covered by the eula for redistribution, and you cannot legally put them on a machine without installing visual studio.
Pete Kirkham
+1  A: 

You're missing necessary runtime libraries (for example, MSVCRT.DLL, MSVCR80.DLL, etc.). Possibly you'll need to install the runtime libraries on the target machine (this would typically be done by an installer). First, make sure you're linking against the release version of the runtime DLLs (the debug versions are not redistributable).

If you don't know which DLLs you're missing, you can open your executable with the Dependency Walker tool (depends.exe) to see the list of dependencies.

If you're just missing MSVCRT.DLL, you can choose to statically link against it instead.

jamesdlin
A: 

Probably you have built your app with CLR support and included something like appconfig? if you do not need CLR, you can turn it off in project options. If the problem is related with .config file you also can copy it with your PE and everything will work.

Andrew_B