2012-11-22 31 views
0

我想用GTEST但执行告诉我g ++的标准lib路径。而如何增加新的

./netTest: error while loading shared libraries: libgtest.so.0: 
    cannot open shared object file: No such file or directory 
  1. 什么是标准路径在GCC链接查找库
  2. 什么是存储库
  3. 的Debian的标准路径
  4. 如何添加libpaths到g ++(-L标志是否正确?)

注2:我问,因为GTEST的库都在/usr/local/libs/但有刚PYT hon和gtest。所有其他库位于/usr/lib/。因此,我猜测gtest安装程序出错了。

回答

1

PS。也许你可以安装Debian libgtest-dev包(如果有的话)。

  1. 什么是标准路径在GCC链接查找库

您可以gcc -v -x c /dev/null -o /dev/null 2>&1 | grep LIBRARY_PATH

  1. 看到什么是存储库的Debian的标准路径

也许你的意思是动态加载器在哪里寻找共享库。 检查/etc/ld.so.conf和/或/etc/ld.so.conf.d/中的文件。

  1. 如何添加libpaths到g ++(-L标志是否正确?)

可以使用--rpath选项ld。但是,我建议只在开发过程中使用它,而不是在部署过程中使用它。

您还可以将LD_LIBRARY_PATH设置为您的libgtest.so.0的位置。

+0

libgtest-dev只是v1.5的头文件。 debian wheezy上没有libgtest0这个共享库。 ls.so.conf内容:'include /etc/ld.so.conf.d/ *。conf'。 /etc/ld.so.conf.d/libc.conf内容:'/ usr/local/lib'。这正是libgtest.so.0所在的地方。为什么我会提到这个错误? – ManuelSchneid3r

+0

也许缓存没有更新。以root身份运行'ldconfig -v'。 – chill

1

上述问题的答案。 gTest不再使用预编译的库。

Use of precompiled libgtest Not Recommended 
    ------------------------------------------- 

The Google C++ Testing Framework uses conditional compilation for some 
things. Because of the C++ "One Definition Rule", gtest must be 
compiled with exactly the same flags as your C++ code under test. 
Because this is hard to manage, upstream no longer recommends using 
precompiled libraries [1]. 

- 史蒂夫M.罗宾斯,星期六,2012年4月21日17时00分56秒-0500

好犯规惊喜我了,为什么我没有喘息找到库:)