I'm learning to google test. I downloaded gtest, ran commands ./configure
and make
and ended with
$ sudo cp -a include/gtest /usr/include
$ sudo cp -a lib/.libs/* /usr/lib/
i got all this from here. I tried to run this code
#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();
}
like this
$ export GTEST_HOME=~/usr/gtest
$ export LD_LIBRARY_PATH=$GTEST_HOME/lib:$LD_LIBRARY_PATH
$ g++ -I $GTEST_HOME/include -L $GTEST_HOME/lib -lgtest -lgtest_main -lpthread test.cpp
but i received an error
/usr/bin/ld: /tmp/ccVTj3Rk.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
Am i doing something wrong or is it a bug?