Before you begin, make sure you read and understand this post from Google ! This tutorial makes using gtest easy, but may contain unpleasant errors .
1. Get googletest frame
$ wget https://github.com/google/googletest/archive/release-1.8.0.zip
Or get his hand . I think I wonβt beckon this little How-to, so if you come across it and the links are out of date, feel free to edit it.
2. Unzip and create a Google test
$ unzip gtest-1.8.0.zip $ cd gtest-1.8.0 $ ./configure $ make
3. βInstallβ headers and libraries on your system.
$ sudo cp -a include/gtest /usr/include $ sudo cp -a lib/.libs/* /usr/lib/
gTestframework is now ready for use. Just remember to link your project to the library by setting -lgtest as the linker flag and, if necessary, if you have not created your own test mainroutine, the explicit flag -lgtest_main .
Here you can go to the Googles documentation about the structure to find out how it works. Happy coding!
ManuelSchneid3r Jan 10 2018-11-14T00: 00Z
source share