In Ubuntu Linux, I follow the instructions gtestlisted here is to set the gtestmanual copying of header files and libraries at /usr/includeand /usr/lib, respectively.
Then I tried to compile the following code ( test1.cpp)
#include <gtest/gtest.h>
TEST(MathTest, TwoPlusTwoEqualsFour) {
EXPECT_EQ(2 + 2, 4);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest( &argc, argv );
return RUN_ALL_TESTS();
}
with the next team
g++ -lgtest -lgtest_main -lpthread test1.cpp
to see another useless error message:
/usr/bin/ld: /tmp/ccQlmghI.o: undefined reference to symbol '_ZN7testing8internal9EqFailureEPKcS2_RKSsS4_b'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libgtest.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
How can i fix this? Or is there another unittest framework that can be used SIMPLY, with a working example?
The same question is asked here , but without an answer.
source
share