views:

1156

answers:

7

I have written a game that uses GLUT, OpenGL and FMOD. The problem is that the binary won't run, unless Visual Studio 2008 is installed on the computer.

Why is this?

A: 

Do you have dependencies on debug libraries?

hamishmcn
+1  A: 

Welcome to the wonderful world of application deployment.

Run the tool depends on your executable and it will tell you which DLLs you need to also copy along with your EXE.

Frank Krueger
A: 

Try compiling in release mode, and make sure that all required DLLs are installed on the target machine. It works for me.

csl
+2  A: 

This program can help you find what dlls (if any) are missing on the the computer that it won't run on

hamishmcn
+2  A: 

Only the release versions of the C runtime and the C++ standard library dlls are installed with Windows by default. Installing Visual Studio will additionally install the debug versions.

Make sure the version you're deploying is built entirely in release mode.

James Hopkin
+10  A: 

Most likely you're linking with DLL versions of the C/C++ runtime. Go to project properties -> C++ -> Code Generation, and set Runtime Library to not be one of "DLL" kinds.

Alternatively, you can link to DLL runtimes, but then you have to redistribute the runtime with your application.

MSDN has more information on various aspects of C++ application deployment: http://msdn.microsoft.com/en-us/library/zebw5zk9.aspx

Also, Dependency Walker (depends.exe) will show what libraries your executable depends on. It ships with some versions of Visual Studio as well.

NeARAZ
Thank you, by setting the Runtime Library to: "Multi-threaded Debug (/MTd)" it now works
Brock Woolf
That surprises me: the 'MTD' dlls only ships with a VisualStudio installation! You sure?
xtofl
@Brock Woolf: of course, in Release configuration, you probably don't want to link to Debug runtime library.@xtofl: that is a static runtime library. So once you link to it, there's no dependency on external DLLs.
NeARAZ
+5  A: 

You mean why is Microsoft Visual C++ 2008 Redistributable Package (x86) needed?

This package installs runtime components of C Runtime (CRT), Standard C++, ATL, MFC, OpenMP and MSDIA libraries. For libraries that support side-by-side deployment model (CRT, SCL, ATL, MFC, OpenMP) they are installed into the native assembly cache, also called WinSxS folder, on versions of Windows operating system that support side-by-side assemblies.

Because they are not installed on all Windows by default, especially the ones that shipped before VS 2008.

Even for

cout << "Hello, World" << endl;

You need a library, which in this case the Standard C++ library.

eed3si9n