I’ve converted a project to VS2010. It includes a googletest based unit test project. When I use the macro EXPECT_EQ, I get the following linker error:
LNK2019: unresolved external symbol “class testing::internal::String
__cdecl testing::internal::StrStreamToString(class std::basic_stringstream,class
std::allocator > *)” (?StrStreamToString@internal@testing@@YA?
AVString@12@PAV?$basic_stringstream@DU?$char_traits@D@std@@V?
$allocator@D@2@@std@@@Z) referenced in function “public: class
testing::internal::String __thiscall
testing::Message::GetString(void)const ” (?
GetString@Message@testing@@QBE?AVString@internal@2@XZ)
When I use EXPECT_TRUE, everything works fine. Does anybody know about this issue?
Thank you
EXPECT_EQ attempts to convert your data values into strings for display purposes; EXPECT_TRUE does not.
Without seeing your code, it would appear that you are testing a user type for which this functionality can be compiled but not linked ie is not implemented.
This is a common problem. If EXPECT_TRUE works, you might just want to stick to it.