相关疑难解决方法(0)

为什么每次运行应用程序时都必须使用导出定义LD_LIBRARY_PATH?

我有一些使用一些共享库的代码(gcc上的c代码).编译时我必须使用-I和-L显式定义include和library目录,因为它们不在标准位置.当我尝试运行代码时,出现以下错误:

./sync_test 
./sync_test: error while loading shared libraries: libsync.so: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)

但是,执行以下操作,一切正常:

export LD_LIBRARY_PATH="/path/to/library/"
./sync_test
Run Code Online (Sandbox Code Playgroud)

现在,奇怪的是,这只能工作一次.如果我再次尝试运行sync_test,除非我先运行export命令,否则会得到相同的错误.我尝试将以下内容添加到我的.bashrc中,但它没有区别:

LD_LIBRARY_PATH="/path/to/library/"
Run Code Online (Sandbox Code Playgroud)

c linux gcc shared-libraries ld

41
推荐指数
5
解决办法
11万
查看次数

链接 INTEL tbb 库时出现问题

我读了这些主题:

使用 gcc 在 Linux 上运行线程构建模块 (Intel TBB)

无法将英特尔 TBB 库与 /usr/lib 中的 libtbb 链接

即使指定了标头,g++ 也找不到标头

g++找不到头文件

g++ 找不到标头,但我确实包含了它们

但仍然收到此错误:

   piCalc.cpp:8:17: fatal error: ttb.h: No such file or directory
 #include "ttb.h"
Run Code Online (Sandbox Code Playgroud)

我计算 pi 的代码始于

#include <iostream>
#include "ttb.h"
#include "parallel_for.h"
Run Code Online (Sandbox Code Playgroud)

运行安装了 nvidia 和 cuda 的 Ubuntu 14.04。为了安装 TBB,我从以下开始:

sudo apt-get install libtbb-dev
Run Code Online (Sandbox Code Playgroud)

它说

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libtbb-dev is already the newest version.
The following package was automatically installed and is no …
Run Code Online (Sandbox Code Playgroud)

c++ linux gcc tbb

5
推荐指数
1
解决办法
8946
查看次数

标签 统计

gcc ×2

linux ×2

c ×1

c++ ×1

ld ×1

shared-libraries ×1

tbb ×1