菜鸟问:请问如何在Linux下安装gtest

kurorohisoka 2010-09-29 11:14:26
谢谢!
...全文
844 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
bluejays 2010-09-30
  • 打赏
  • 举报
回复
我觉得最好不要直接修改/etc/ld.so.conf文件.
这样可能好一点: 到/etc/ld.so.conf.d/里面新建一个文件gtest.conf, 内容是/usr/local/lib
bluejays 2010-09-30
  • 打赏
  • 举报
回复
include ld.so.conf.d/*.conf
include /usr/local/lib ---去掉include,改成这样

include ld.so.conf.d/*.conf
/usr/local/lib


steptodream 2010-09-30
  • 打赏
  • 举报
回复
很多人自己加的时候 都给多来一个include 也不看看第一个inlucde的是在干什么
kurorohisoka 2010-09-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 bluejays 的回复:]

http://blog.chinaunix.net/u3/106187/showart_2247811.html
[/Quote]
test.cpp:
#include <test/gtest.h>
#include <iostream>
using namespace std;
TEST(A,a)
{
EXPECT_EQ(1,1);
}


int main(int argc,char** argv)
{
testing::InitGoogleTest(&argc,argv);
return RUN_ALL_TESTS();
}

/etc/ld.so.conf文件内容:
include ld.so.conf.d/*.conf
include /usr/local/lib

gcc $(gtest-config --ldflags --libs) -o test test.cpp运行无错误。
gtester -k test出错:
TEST: test... (pid=13010)
test: error while loading shared libraries: libgtest.so.0: cannot open shared object file: No such file or directory
FAIL: test


请问如何解决,谢谢。
bluejays 2010-09-29
  • 打赏
  • 举报
回复
http://code.google.com/p/googletest/
下载 gtest-1.5.0.tar.bz2
解压 tar xjvf gtest-1.5.0.tar.bz2
然后看其中的README文件的提示。
./config
make
make install

23,116

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧