Mr Chris
Mr Chris

Reputation: 1240

Including DLL's In VC++(VS2010) Project Output

Disclaimer: Am a C# developer trying to understand a few C++ fundamentals

Have created a command line project which has the .lib of a DLL file linked under Linker > Input > Additional dependencies, and also has the location of the header files specified under C/C++ > General > Additional Include Directories. Ran a build and all compiled okay, with the .exe being built in the Debug/Release dir.

Problem is I also expected the .dll file the project depends on to be there (just like when you add a reference in a .Net project) - but it isn't. When launching the .exe it complains that it can't find the DLL. Fair enough, but why didn't the VC++ put the DLL there if it knows it's required?

And is there a "best practice" to ensuring the dependent DLL files are in the output dir, other than manually copying them there? I have a project that will require use of some third-party libraries, and I was hoping the IDE would help me manage them...

Big thanks for any guidance given!

Upvotes: 0

Views: 424

Answers (1)

Alex F
Alex F

Reputation: 43311

If you create solution which contains exe and dll, all output files are created in $(SolutionDir) Debug or Release subdirectories, and exe runs successfully. Otherwise, you have one of the following options:

  1. Copy Dll in Post-build step to directory where it is available for loading (usually .exe directory)

  2. Add Dll directory to PATH.

Upvotes: 1

Related Questions