当前位置:网站首页>GTEST from ignorance to skillful use (1) GTEST installation

GTEST from ignorance to skillful use (1) GTEST installation

2022-07-04 21:41:00 Wonderful binary

1、 Install... From source

download gtest,release-1.8.0

​ git clone https://github.com/google/googletest

gtest compile

cd googletest

Generate Makefile file ( Install first cmake,brew install cmake), Continue to enter the command to compile :

cmake CMakeLists.txt

perform make, Generate two static libraries :libgtest.a libgtest_main.a

make

Copy to system directory , Be careful , If the directory location changes in different versions , use find . -name “libgtest*.a” Find a place

​ sudo cp libgtest*.a /usr/lib

sudo cp –a include/gtest /usr/include

Check if the installation is successful

You can write a simple test code as follows :

#include<gtest/gtest.h>
int add(int a
原网站

版权声明
本文为[Wonderful binary]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/185/202207042048259945.html