Reputation: 65
I've inherited a legacy code project at work, and I'd like to add some unit tests to it before I make some changes. I'm working on a Visual C++ project using VS2010. I've been playing around with Google Test as the unit testing framework.
I've been able to successfully add a unit test project to the existing solution, and I wrote a basic test to verify that it will run. My existing solution builds a DLL, but the problem happens because it implicitly links to a third party DLL. That DLL requires another third party DLL, and so on. I can build but when I run I get the following error:
"The program can't start because thirdParty.dll is missing from your computer. Try reinstalling the program to fix this problem."
If I put all the dependent DLLs into the folder where my unit test executable lives everything works fine, but I would like to know if there's any way to run the executable without having all of those third party DLLs. The code I'm about to change doesn't actually make any calls in to any of the functions used by the various third party DLLs, and I'd like to wrap the calls to them so I can mock them but right now it seems as if I need them.
I apologize in advance if I'm not explaining anything clearly. I'm new to C++ and Visual Studio.
Upvotes: 0
Views: 392
Reputation: 6842
I have the same problem and solved it by telling the link that these DLL are loaded when required.
Open the project properties->Linker->Input->Delay Loaded Dlls
Specify your DLL's that are not required to be loaded unless called.
Upvotes: 1