0

i am trying to run an exe file on another computer that doesn't have visual studios installed. When i try run the file i get the error : This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

I tried searching for the answer and i lot of websites mention static link run-time assemblies

but i have no idea how to add them into my project.

(Program is in visual studios 2008 in c++ console)

Karen123456
  • 327
  • 1
  • 3
  • 10
  • I don't have Visual Studio on this machine. But, I think under project properties > linker there is an option that you can change from dynamically linked to statically linked. – Travis Pessetto Mar 11 '13 at 15:11
  • the program doesn't run if i change the runtime library. current library is: Multi-threaded DLL (/MD) – Karen123456 Mar 11 '13 at 15:12
  • Statically linked libraries (if this is what you talk about, as it is not 100% clear) can't be the reason for this as they are part of your deployed executable, and not deployed separately – Zdeslav Vojkovic Mar 11 '13 at 15:14
  • i am not really sure what i need to do. can you see a solution to this problem? i just want to run the exe file on another computer – Karen123456 Mar 11 '13 at 15:16
  • You can use the [Visual C++ 2008 Redistributable Packaage](http://www.microsoft.com/en-us/download/details.aspx?id=29) to run on a computer without Visual Studio installed. I think this is what some projects do. – Travis Pessetto Mar 11 '13 at 15:17
  • already tried that. still get same error – Karen123456 Mar 11 '13 at 15:18
  • I suggest checking the exe with a tool like Dependency Walker (http://www.dependencywalker.com/) on the target machine. It will show you which dlls are missing. If everything seems OK, you can profile it from DW, to check if any delay-loaded or COM dll is missing – Zdeslav Vojkovic Mar 11 '13 at 15:20
  • The following StackOverflow post: http://stackoverflow.com/questions/5936724/how-to-redistribute-vc-application-from-visual-studio-2008 recommends that you create an installer and let Visual Studio package everything it needs into an installer. – Travis Pessetto Mar 11 '13 at 15:22
  • i don't really want to download anything on the other computer. i want the exe to run without having to install extra things on each computer – Karen123456 Mar 11 '13 at 15:22
  • are you running the debug version? – Zdeslav Vojkovic Mar 11 '13 at 15:25
  • yes. i am taking the exe from the debug folder of the program – Karen123456 Mar 11 '13 at 15:28
  • 2
    Then deploy the release version. Your target machine doesn't have debug MFC and runtime dlls. – Zdeslav Vojkovic Mar 11 '13 at 15:28
  • I have added a more details answer to have it all in one place – Zdeslav Vojkovic Mar 11 '13 at 15:31

1 Answers1

3

It is hard to tell exactly what libraries are missing. Here are some ideas.

  • You are deploying a debug version. As non-development computers typically don't have debug libraries deployed (mfc*xxxd.dll & co.) your app cannot start. You should deploy the release version.
  • You app is built with newer version of C runtime or MFC which is not available on target machine. You should install Visual C++ redistributable package for your version of VS / development tools.
  • If you can't install this, you should statically link runtime/MFC libraries to your app. Depending on your version of VS, you need to go to project settings and check correct version of runtime libs (static vs dynamic)

If still there are issues, you should check exactly which dlls are missing by using a tool like Dependency Walker on the target machine (actually this should always be the first thing you should do instead of guessing). It will show you which dlls are missing. If everything seems OK, then you are missing some delay-loaded or COM dll - this are not loaded on startup but on demand. You can use DependencyWalker to profile the startup of the app to see exactly what's missing.

Zdeslav Vojkovic
  • 14,391
  • 32
  • 45