What's the difference between gtest.lib and gtest_main.lib?

前端 未结 3 1654
予麋鹿
予麋鹿 2020-12-24 01:26

Google\'s C++ Test Framework has two output libraries: one is gtest.lib and the other one is gtest_main.lib. According to Nik Reiman\'s answer on how to setup gtest with Vis

3条回答
  •  猫巷女王i
    2020-12-24 02:15

    the only reasonable difference is that gtest_main.lib provides a default implementation of a test application entry point (i.e. main function):

    Citation from Getting started with Google C++ Testing Framework:

    "[...] maybe you think that writing all those main() functions is too much work? We agree with you completely and that's why Google Test provides a basic implementation of main(). If it fits your needs, then just link your test with gtest_main library and you are good to go."

    If you want to write your main function yourself - you should link with gtest.lib.

提交回复
热议问题