Google Tests in a DLL
c++, googlemock, googletest, unit-testing, visual-studio
Solution
GoogleTest and GoogleMock do not need to be compiled into a .dll.
Rather it is saying that they need to be compiled with the same `Runtime Library` setting as the project consuming (linking) them (`/MD` or `/MT`). Runtime Library Settings
Consistency is the key! When linking any library (LIB or DLL), they should have the same `Runtime Library` setting as the project (or vice versa).
I would also recommend using the same `Character Set` setting.
Problem
I want to write unit tests using Google Test / Mock for code in my DLL. The test code is supposed to be compiled into my DLL. I read in the Google Test Primer that this is possible, but that gtest has to be compiled into a DLL then (and I guess the same thing holds for gmock, too). Has anybody compiled and used the framework as DLL's and can tell me the most important project settings (I use VS2010) and how to use the resulting DLL's to run the tests?