79561691

Date: 2025-04-08 09:49:03
Score: 1
Natty:
Report link

As Tamás Szelei stated in his comment on Andrey's answer: "gtest_main is not an alternative to gtest. You need to link with gtest if you want to use the library either way." I would like to make this answer even clearer. At least for me, the following variant is more understandable:

gtest_main.lib is not an alternative to gtest.lib. You need to link both gtest_main.lib and gtest.lib together if you want to use the gtest framework (Linker -> Input -> Additional Dependencies) and if you don't want to write your own main function.

While the original comment wasn’t entirely clear to me, my clarification makes the topic unequivocally understandable, as the gtest documentation on GitHub states that you should link either gtest_main or gtest: https://github.com/google/googletest/blob/main/docs/primer.md

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Patoka