views:

8403

answers:

5

This is the error Dependency Walker gives me on an executable that I am building with VC++ 2005 Express Edition. When trying to run the .exe, I get:

This application has failed to start because the application configuration
is incorrect. Reinstalling the application may fix this problem.

(I am new to the manifest/SxS/etc. way of doing things post VC++ 2003.)

EDIT: I am running on the same machine I am building the .exe with. In Event Viewer, I have the unhelpful:

Faulting application blah.exe, version 0.0.0.0, faulting module blah.exe,
version 0.0.0.0, fault address 0x004239b0.
+2  A: 

Run Event Viewer: it'll have more information.

Probably you've attempted to run your program on a machine that doesn't have the VC redistributables installed, or you're attempting to run a debug build on a machine that doesn't have Visual Studio installed (the debug libraries aren't redistributable).

Roger Lipscombe
I am building and running on the same machine with VC++ 2005 Express Edition installed. Could the Express Edition be the issue?
Jim Buck
(I mean, it would be odd to not be able to run a .exe on the very machine that built it. It would mean that the Express Edition is broken.)
Jim Buck
Did you look in Event Viewer?
Roger Lipscombe
Yep, I just updated my OP with the results. Not very helpful info from EV, though.
Jim Buck
+1 Thank you! One of my dlls was linking with a debug dll rather than release causing a crash on every machine but mine. i didn't know before now that the debug libraries aren't redistributable!
0xC0DEFACE
+2  A: 

I've had this problem. The solution has two steps:
1. Compile your program in "Release" mode instead of "Debug" mode (there's usually a combo-box in the toolbar)
2. Download from Microsoft their Redistributable Package of runtime components. Make sure to download the x86 edition for 32-bit computers and the x64 edition for 64-bit computers/OSes. Install this package on the target computer, and your application should run fine

P.S. This is a SxS thing
P.P.S. Alternatively, use a different compiler (like GCC, for example with Dev-Cpp) to compile your program's source, and your headaches will disappear.

Cameron
+3  A: 

Open the properties sheet for your project, go to the Configuration Properties -> C/C++ -> Code Generation page, and change the Runtime Library selection to /MT or /MTd so that your project does not use the DLL runtime libraries.

The C/C++ DLL runtimes used by VS2003 and up are not automatically distributed with the latest version of the OS and are a real pain to install and get working without this kind of problem. statically link the c-runtime and just avoid the total mess that is manifests and version specific runtime dlls.

Chris Becke
amen to the mess that is manifests.
gbjbaanb
If you are willing to face a much bigger DLL, this should work
I marked your answer correct since it does work if you have the ability to recompile all your application's code and code for the libraries it links to. But, what do you do if one of the .lib files you are linking with has no associated code you can recompile but was using runtime .DLL? I have no choice but to compile the same way, but what .dll files do I need to have in the app's root directory in order for anyone to run the app? (This is an internal app and doesn't need some generic install process, so it's fine if I just manually copy the .dlls.)
Jim Buck
+3  A: 

Sorry to bump an old question, but I was able to get around this exact issue and thought I'd post a solution in case someone else needs it...

Even after installing Microsoft's redistributable DLLs I was getting this error, the fix was to copy the

C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT

folder into the application's directory on the target PC. After that, no more problems.

BTW, the DLL that was giving me issues was a 3rd-party DLL that had never had problems before on over 100 other computers... go figure.

Ian Kemp
Unfortunately, the redist folder does not appear to be bundled with express editions.
Chris Becke
A: 

I have had the same issue with VS 2008-built debug binaries on other winxp sp3 computers.

  • I first tried installing the client machine with vc redist package,as it seemed sensible. Annoyingly, it didn't work.
  • I tried copying all the dependent dlls to the application's directory - still didn't work

    After being struck over this issue for hours, I found that the latest VS builds require manifests and policies to link with the dlls. After copying the respective policies and manifests into their respective "C:\WINDOWS\WinSxS\" folders, I got it working.

The problem was caused due to the fact that the vc redist package did not install debug versions of dlls, they somehow thought its up to the programmer to figure that out.

Sundar