Take the 2-minute tour ×

Kind of a simple question, but when I compile an application I'd like to make it so the user doesn't need all the dll's/shared objects and can just have one standalone executable. How do I do this? Either in a Makefile or in CodeBlocks' settings.

share|improve this question
Which platform are you on? –  Andre Jan 18 '12 at 6:09
It is probably operating system specific. You could tag your question as Windows only! On Linux, it probably would be easier (eg. by statically linking). And I'm not sure it is a good idea to package all your file inside the executable... –  Basile Starynkevitch Jan 18 '12 at 6:10

2 Answers 2

up vote 3 down vote accepted

If you have the source, or if you have the right kind of .lib file, you can statically link. (Note, however, that DLLs also sometimes come with a .lib file, and that file is just a shim for calling into the DLL.) If you can statically link, you'll have a single executable.

Other than that, make an install directory and put the DLL into the same directory as the executable. That's the easiest way.

There's probably a trick where you could inject the DLL into executable and write a custom loader that would act like a DLL, but you really don't want to go down that path.

share|improve this answer

You can use a static link library instead of a DLL if you have the source code.

share|improve this answer

Your Answer

