0

I have developed a application in VC++ (Visual Studio 2008 version '9.0.30729.1SP').

When i just double click on exe file in another machine. it is giving me 'side by side' error.

I have checked that machine does not having anything inside 'C:\Program Files\Microsoft Visual Studio 9.0\VC' folder. (but having framework 3.5 installed)

What i need to do?I am very new in VC++ applications.

Please can anyone explain how can i merge everything into a setup from machine where i have compiled my application.

Even 'C:\Program Files\Microsoft Visual Studio 9.0\VC' folder also.

Please help in this issue.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
prashant
  • 361
  • 9
  • 26

2 Answers2

3

The best thing to do is to create a setup program. It will automatically install all necessary dependencies onto the user's machine, along with your application. You definitely don't want to try to find all of the libraries it depends on by manually scouring your drive. And static linking is generally not a preferred option, as it means your app won't automatically take advantage of updates made to the runtime DLLs.

Visual Studio even has out-of-the-box support for creating an installer for your application. To use it, select File -> New -> New Project. Then expand "Other Project Types" in the dialog, and expand "Setup and Deployment". Click on "Visual Studio Installer", and choose to create a new "Setup Project".

   

Or, if you'd rather not use Visual Studio, the free, full-featured Inno Setup is a fantastic alternative.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • Thanks.Are it will also include 'C:\Program Files\Microsoft Visual Studio 9.0\VC' folder?Will try. – prashant May 09 '11 at 12:26
  • @prashant: No, it won't include that entire folder. But you don't need the entire folder just to run the application. It *will* include the files that it needs. – Cody Gray - on strike May 09 '11 at 12:27
  • one more thing when i try to run the exe on another machine which is having VS2008 installed then also i am getting error saying 'the application has failed to start because the application configuration is incorrect' any idea. – prashant May 09 '11 at 12:40
  • @prashant: Yup, they're there in VS 2008. At least in the Professional Edition. I've updated my screenshot to match that version (as I would have done in the first place, had I been paying more attention). Are you by chance using the *Express* edition? It might not come with support for creating a setup project. In that case, you either need to obtain a full version of VS, or look elsewhere for installer options. I recommended Inno Setup in my answer, it's one of my personal favorites. – Cody Gray - on strike May 10 '11 at 08:14
  • Now I have created setup using VS2008.I am added merge modlude for Microsoft_VC80_CRT_x86.msm and all.But still unable to work on different machine. As you can see here my manifest file requires different versions of dll..http://stackoverflow.com/questions/5945312/the-application-has-failed-to-start-because-the-application-is-incorrect. So i installed all versions Vcredist_x86.exe and it works.... – prashant May 11 '11 at 03:52
2

Install the Visual C++ 2008 Redistributable package on the other machine. This will ensure that all the required CRT libraries are available. If your application needs any other DLLs, they need to be in the same folder (or in the system path) as your application.

If you want to do it properly, I highly recommend Cody's answer. But if you want to quickly run an application which may or may not have external DLLs, then this method will work.

Community
  • 1
  • 1
Jacob
  • 34,255
  • 14
  • 110
  • 165
  • 1
    Yeah, installing the redistributable is still way better than trying to copy the files over manually, though. I've seen an unfortunately number of people asking questions here after trying to deploy applications compiled in Debug mode dependent upon debug versions of the CRT or MFC DLLs. – Cody Gray - on strike May 09 '11 at 12:43
  • @Cody: Yeah, I don't think even redistributables can fix the whole "manifest hell" issue with VS. Have you ever encountered that with the setup file method? – Jacob May 09 '11 at 13:06
  • 1
    No, an installer generally gets this type of thing right. At least, I haven't had a problem yet. But I also do a lot more static linking for C++ code than I might recommend to others. Typically, if I've chosen to use C++ rather than .NET, it's because I want the code to run with as few dependencies as absolutely possible. – Cody Gray - on strike May 09 '11 at 13:10