linux gtest安装
1. 安裝cmake, 具體步驟這里不詳說。
2. 下載源碼:https://codeload.github.com/google/googletest/zip/release-1.8.0
3. 解壓源碼:unzip googletest-release-1.8.0.zip
4. 進入源碼目錄:cd googletest-release-1.8.0
5. 創(chuàng)建并進入目錄build:mkdir build && cd build
6. 編譯:cmake .. && make
7. 將生成的libgtest.a和libgtest_main.a, 復(fù)制到/usr/local/lib/下去
sudo cp libgtest.a libgtest_main.a /usr/local/lib/
8.將include中的gtest文件夾復(fù)制到/usr/local/include
cd googletest-release-1.8.0
sudo cp -rf include/* /usr/local/include/
?
9. 使用gtest
編寫一個test.cpp
g++ -o test test.cpp -lgtest -lgtest_main -lpthread
這里不需要指定路徑是因為:
/usr/local/lib路徑,在/etc/ld.so.conf中存在
/usr/local/include路徑,在/etc/profile中存在
?
轉(zhuǎn)載于:https://www.cnblogs.com/smallcroco-blog/p/6648329.html
總結(jié)
以上是生活随笔為你收集整理的linux gtest安装的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 汉企第一天
- 下一篇: unity案例入门(二)(坦克大战)