2

I'm making a game using C++ and DirectX and it'd be nice to share my groups progress with other people by providing a single executable file instead of having to run a setup wizard.

I've checked my Release and Debug folders but those executable don't work. The release .exe is something like 21KB which doesn't seem right.

So I guess what I'm asking is how to make a single executable with all of the libraries and resource files included.

Uri
  • 2,306
  • 2
  • 24
  • 25
  • You're better off with the installer method. You really don't want to statically link to the runtime and you want to make sure your project is distributable, as you would when you release it, anyway. – Edward Strange Mar 07 '11 at 00:18

2 Answers2

3

If VS2010 is anything like VS2008, you need to go to project properties/c++/code generation and select a static runtime library.

Erik
  • 88,732
  • 13
  • 198
  • 189
2

You need to specify that all your libraries have to be statically linked in. There are several threads about doing this in Visual Studio, like:

However, to add on to those answers linked, be aware that:

  • You must have actual static libraries to link against. In many instances, .lib files in Windows land are stub libraries that link to the DLL.
  • Perhaps not everything you need to be statically linked can be (i.e. you will not find a static link library of it)
  • You don't have to distribute your binary as a completely statically linked executable. You can ship all the dependent libraries in the same directory as your executable. This could simplify future sharing as you'd only have to replace some libraries vs. sending the entire file to everyone.
Community
  • 1
  • 1
wkl
  • 77,184
  • 16
  • 165
  • 176
  • Thanks for the reply, this helped me get closer to what I was looking for, although I still can't get it working. I think it's because I don't have all of the static libraries like you said. – Uri Mar 08 '11 at 04:17