Installing the Google C++ Testing Framework (gtest)
There are two options: (A) installing from a pre-compiled package; and (B) downloading and building it manually. The first option is more comfortable but does not work anymore on newer systems, for reasons explained here (which you need not read or understand, just follow Option B below then).
Option A: Installing from Ubuntu / Debian package
Step A1: Install the corresponding package (you need to be root or have sudo rights for this):
sudo apt-get install libgtest-dev
Step A2: Verify that the installation worked by checking the existence of the following files:
/usr/local/include/gtest/gtest.h /usr/local/lib/libgtest.a /usr/local/lib/libgtest.so or /usr/include/gtest/gtest.h /usr/lib/libgtest.a /usr/lib/libgtest.so
If you don't find these files resort to the manual installation described in the following section.
Option B: Installing gtest manually
Step B1: Download the latest version from http://code.google.com/p/googletest, for example:
Step B2: Unpack the archive, change to the corresponding directory and build the code from its source:
unzip gtest-1.6.0.zip cd gtest-1.6.0 ./configure make
Step B3: Install the files, that is, copy them to the proper systems directories (you need to be root or have sudo rights for that):
sudo make install
This step might fail for newer versions of gtest, with a message similar to the following one:
'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system.
In that case, just copy the header and library files manually to the proper system files (again, you need to be root or have sudo rights for that):
sudo cp -a include/gtest /usr/local/include sudo cp -a lib/.libs/* /usr/local/lib
After that, check that the following files exist (just like for step A2 above):
/usr/local/include/gtest/gtest.h /usr/local/lib/libgtest.a /usr/local/lib/libgtest.so
If the library is still not found by the compiler, you can run: