码迷,mamicode.com
首页 > 系统相关 > 详细

linux gtest安装

时间:2017-03-30 20:42:32      阅读:1265      评论:0      收藏:0      [点我收藏+]

标签:thread   UI   使用   com   oca   make   file   编写   build   

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. 创建并进入目录build:mkdir build && cd build

6. 编译:cmake .. && make

7. 将生成的libgtest.alibgtest_main.a, 复制到/usr/local/lib/下去

 sudo cp libgtest.a libgtest_main.a /usr/local/lib/

8.将include中的gtest文件夹复制到/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中存在

 

linux gtest安装

标签:thread   UI   使用   com   oca   make   file   编写   build   

原文地址:http://www.cnblogs.com/smallcroco-blog/p/6648329.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!