Uri
Uri

Reputation: 2346

How to make a Single Executable VS 2010

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.

Upvotes: 2

Views: 5742

Answers (2)

wkl
wkl

Reputation: 79911

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.

Upvotes: 2

Erik
Erik

Reputation: 91270

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

Upvotes: 3

Related Questions