linking error with new 1.4.0 version

65 views
Skip to first unread message

Prashant

unread,
Oct 3, 2009, 2:20:15 PM10/3/09
to Google C++ Testing Framework
Hi,

I am getting linking error when I used new 1.4.0 gtest. When I
use gtestd.lib built with 1.3.0 version the same project compiles
without any error.

The error is as below.

gtestd.lib(gtest.obj) : error LNK2005: "public: __thiscall
testing::internal::AssertHelper::~AssertHelper(void)" (??
1AssertHelper@internal@testing@@QAE@XZ) already defined in test2.obj

test2.obj : error LNK2019: unresolved external symbol "public:
__thiscall testing::internal::AssertHelper::AssertHelper(enum
testing::TestPartResultType,char const *,int,char const *)" (??
0AssertHelper@internal@testing@@QAE@W4TestPartResultType@2@PBDH1@Z)
referenced in function "private: virtual void __thiscall
testing::MyDemoTests_Addition_Test::TestBody(void)" (?
TestBody@MyDemoTests_Addition_Test@testing@@EAEXXZ)

The test program that I am using is like:

#include <gtest/gtest.h>
#include <iostream>

namespace testing {

TEST(MyDemoTests, Addition) {
EXPECT_EQ(2, 1+1);
}

TEST(MyDemoTests, Substraction) {
EXPECT_EQ(2, 3-1);
}

} // namespace testing

int main(int argc, char **argv) {
std::cout << "Running main() from test1.cpp\n";

testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

I am using Visual Studio .Net 2003 for my work. For this test first I
complied gtest project with rumtime library option set as Multi-
threaded debug. Then for my test project I given path to this
gtestd.lib in linked options.

The same project works fine if I use gtestd.lib from 1.3.0 version.

Thanks,
Prashant

Prashant

unread,
Oct 3, 2009, 11:25:22 PM10/3/09
to Google C++ Testing Framework
I sorted it out. I was missing to override new header files that comes
with version 1.4.0

Thanks,
Prashant
Reply all
Reply to author
Forward
0 new messages