Search code examples
c++visual-studio-2010googletestgooglemock

What is the difference between gmock_main and gtest_main?


I've noticed that some projects refer to gtest_main-mdd.lib and others to gmock_maind.lib in my Visual Studio 2010 setup and wanted to know what the difference between the two libs is?


Solution

  • Projects don't have to use both gtest and gmock but one might want to choose using gtest without gmock or vice versa. For either case you need a way to introduce the main function, hence you have 2 libs for introducing it.

    Anyway, if you are using both then it's better to use gmock_maind.lib since it has an initialization for the mock framework and for the test framework as well. While gtest_main-mdd.lib initializes only the test part. Look at the gmock_main.cc and gtest_main.cc