Size: 1147
Comment:
|
← Revision 14 as of 2022-04-19 22:49:31 ⇥
Size: 1427
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 14: | Line 14: |
wget https://github.com/google/googletest/archive/release-1.10.0.zip | wget https://github.com/google/googletest/archive/release-1.11.0.zip |
Line 17: | Line 17: |
'''Step 3:''' Unpack the archive, change to the corresponding directory and build the code from its source (this requires ''cmake''): | '''Step 3:''' Unpack the archive, change to the corresponding directory and build the code from its source (this requires ''cmake'' which can be installed using your favorite package manager, for example: ''apt'' on Ubuntu or ''brew'' on Mac): |
Line 20: | Line 20: |
unzip release-1.10.0.zip cd googletest-release-1.10.0/googletest mkdir bld cd bld cmake .. |
unzip release-1.11.0.zip cd googletest-release-1.11.0 mkdir build cd build cmake .. -DBUILD_GMOCK=OFF |
Line 26: | Line 26: |
sudo make install | |
Line 28: | Line 29: |
'''Step 4:''' Install the files, that is, copy them to the proper systems directories (you need to be root or have sudo rights for that): {{{ cp -a -r ../include/gtest /usr/local/include/. cp -a ./lib*.a /usr/local/lib }}} |
|
Line 45: | Line 40: |
rm -rf release-1.8.0.zip googletest-release-1.8.0 | rm -rf release-1.11.0.zip googletest-release-1.11.0 |
Line 47: | Line 42: |
= Troubleshooting = * ''Gtest 1.8.1'' is the last release supporting ''pre-C++11'' compilers. So if you get any errors when using Gtest > 1.8.1 in combination with a compiler that doesn't use the ''C++11'' standard per default, try to add the ''-std=c++11'' flag to your compile command, for example: {{{ g++ -std=c++11 -c ApproximateEulersNumber.cpp }}} |
Installing the Google C++ Testing Framework (gtest) globally
Step 1: Change into the temporary directory, for example:
cd /tmp
Step 2: Download the latest (major) version from https://github.com/google/googletest/releases, for example:
wget https://github.com/google/googletest/archive/release-1.11.0.zip
Step 3: Unpack the archive, change to the corresponding directory and build the code from its source (this requires cmake which can be installed using your favorite package manager, for example: apt on Ubuntu or brew on Mac):
unzip release-1.11.0.zip cd googletest-release-1.11.0 mkdir build cd build cmake .. -DBUILD_GMOCK=OFF make sudo make install
(optional) Step 5: If the library is (still) not found by the compiler, you can run (as root or with sudo):
ldconfig
(optional) Step 6: Clean up:
cd /tmp rm -rf release-1.11.0.zip googletest-release-1.11.0
Troubleshooting
Gtest 1.8.1 is the last release supporting pre-C++11 compilers. So if you get any errors when using Gtest > 1.8.1 in combination with a compiler that doesn't use the C++11 standard per default, try to add the -std=c++11 flag to your compile command, for example:
g++ -std=c++11 -c ApproximateEulersNumber.cpp