1

I downloaded Google Test and built it under MSVC 2010. I then linked its target, gtest.lib (or, gtestd.lib under Debug Configuration) against my executable.

The outcome is a long list of multiply defined symbols. In short:

error LNK1169: one or more multiply defined symbols found
warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
error LNK2005: _vprintf already defined in MSVCRTD.lib(MSVCR100D.dll)
error LNK2005: _printf already defined in MSVCRTD.lib(MSVCR100D.dll)

and the list goes on and on. Most are VC runtime symbols but a few are gtest symbols. What error have I made? The gtest primer states:

To write a test program using Google Test, you need to compile Google Test into a library and link your test with it.

But doesn't really elaborate beyond that.

Jesse Hallam
  • 6,794
  • 8
  • 48
  • 70

0 Answers0