Author Topic: Including DLLs in a project  (Read 3831 times)

greyhat

  • Guest
Including DLLs in a project
« on: June 22, 2008, 01:53:13 am »
It's probably been asked before, but I haven't found anything about it.  Is there a way to tell Code::Blocks to include the required DLLs in the exe output directory?

For example, if you want the output directory of your project to contain everything it needs for distribution, you'll often need to drop all the needed DLLs in with the executables.  Usually that means hunting down whatever DLLs were used in linking, and copying them over manually before you can distribute it.  You might also have to do that before you can even run it yourself if the DLLs weren't sitting in a system directory.

I'm wondering if there's any way within a project's build options to tell Code::Blocks to add copies of whatever DLLs are linked against, into the output directory.  If not, is there an easier way to manage those in a project that I'm not seeing, or is everyone just used to dragging copies manually?  For simpler projects it's probably easy enough to keep track of the files yourself.  But when dealing with a lot of DLLs, it seems like the IDE should know which ones were required for linking, and the option to include copies with the executable would help a lot.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Including DLLs in a project
« Reply #1 on: June 23, 2008, 09:12:51 am »
It's probably been asked before, but I haven't found anything about it.  Is there a way to tell Code::Blocks to include the required DLLs in the exe output directory?
Just place the required (copy) commands in the post build steps of your project (target) settings. In C::B we use a batch file for this purpose which is run in the post-build steps. If the DLL's are also being compiled you could also change the DLL's output path in the target settings to be the same as for the application itself.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ