Wednesday, March 16, 2022

Fix gtest linker error on Windows

If you are getting the below-mentioned linker error with Google gtest on Windows MSVC, the solution is to define the macro within your project file/Makefile.
Linker error:
error LNK2001: unresolved external symbol "class testing::internal::Mutex testing::internal::g_gmock_mutex" ([email protected]@testing@@[email protected]@A)
Macro to declare within your project file/Makefile:
GTEST_LINKED_AS_SHARED_LIBRARY=1

Tags: gtest, linker error

No comments: