google testing missing DSO
There are some errors in your setup.
You copied your include/gtest into /usr/include (sudo cp -a include/gtest /usr/include
), but when you try to compile you tell the compiler to look for the gtest headers in the ~/usr/gtest directory, not in the directory you set up before (/usr/include/gtest). The same things happed with the lib/.libs/* files. You copy them in a place and at compile time you ask for them in another place.
Keeping the following configurations:
$ sudo cp -a include/gtest /usr/include
$ sudo cp -a lib/.libs/* /usr/lib/
change #include <gtest/gtest.h>
into #include "gtest/gtest.h"
and try to compile like this:
g++ -g -Wall <your .cpp files> -I /usr/include/gtest/ -L /usr/lib/ -lgtest -lgtest_main -lpthread
And you should see the following output after running the ./a.out file (or whatever name you assign to the executable file)
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MathTest
[ RUN ] MathTest.TwoPlusTwoEqualsFour
[ OK ] MathTest.TwoPlusTwoEqualsFour (0 ms)
[----------] 1 test from MathTest (0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[ PASSED ] 1 test.