Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/137.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
/usr/bin/ld:警告:未找到xyz.so所需的abc.so(请尝试使用-rpath或-rpath链接)"; 我正在构建一个C++应用程序,使用NETBeaS 6.9作为IDE。我有一个C++库,它是一个纯C库的包装器。_C++_C_Gcc_Ld - Fatal编程技术网

/usr/bin/ld:警告:未找到xyz.so所需的abc.so(请尝试使用-rpath或-rpath链接)"; 我正在构建一个C++应用程序,使用NETBeaS 6.9作为IDE。我有一个C++库,它是一个纯C库的包装器。

/usr/bin/ld:警告:未找到xyz.so所需的abc.so(请尝试使用-rpath或-rpath链接)"; 我正在构建一个C++应用程序,使用NETBeaS 6.9作为IDE。我有一个C++库,它是一个纯C库的包装器。,c++,c,gcc,ld,C++,C,Gcc,Ld,我已将文件正确添加到项目中(使用“添加库文件”选项)。以下是g++和链接器生成的输出: g++ -o dist/Debug/GNU-Linux-x86/testluaembed build/Debug/GNU-Linux-x86/src/main.o build/Debug/GNU-Linux-x86/src/LuaBinding.o -L../../mainline/tanlib_core/dist/Debug/GNU-Linux-x86 -L../../mainline/tanlib++/

我已将文件正确添加到项目中(使用“添加库文件”选项)。以下是g++和链接器生成的输出:

g++  -o dist/Debug/GNU-Linux-x86/testluaembed build/Debug/GNU-Linux-x86/src/main.o build/Debug/GNU-Linux-x86/src/LuaBinding.o -L../../mainline/tanlib_core/dist/Debug/GNU-Linux-x86 -L../../mainline/tanlib++/dist/Debug/GNU-Linux-x86 -L/usr/lib ../../mainline/tanlib_core/dist/Debug/GNU-Linux-x86/libtanlib_core.so ../../mainline/tanlib++/dist/Debug/GNU-Linux-x86/libtanlibpp.so /usr/lib/liblua5.1.a /usr/lib/libtolua++5.1.a /usr/local/boost_1_45_0/stage/lib/libboost_filesystem.a /usr/local/boost_1_45_0/stage/lib/libboost_system.a 
/usr/bin/ld: warning: libtanlib_core.so, needed by ../../mainline/tanlib++/dist/Debug/GNU-Linux-x86/libtanlibpp.so, not found (try using -rpath or -rpath-link)
/usr/lib/liblua5.1.a(loadlib.o): In function `ll_loadfunc':
/usr/lib/liblua5.1.a(loadlib.o): In function `ll_loadfunc':
/usr/lib/liblua5.1.a(loadlib.o): In function `ll_loadfunc':
/usr/lib/liblua5.1.a(loadlib.o): In function `ll_loadfunc':
/usr/lib/liblua5.1.a(loadlib.o): In function `gctm':
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/testluaembed] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
我在C++包装库上运行LDD,得到这个输出:

$ldd libtanlibpp.so 
    linux-vdso.so.1 =>  (0x00007fff123c0000)
    libtanlib_core.so => not found
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fe4f0fde000)
    libm.so.6 => /lib/libm.so.6 (0x00007fe4f0d5a000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fe4f0b43000)
    libc.so.6 => /lib/libc.so.6 (0x00007fe4f07c0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fe4f15ee000)

因此,尽管该文件存在于我的计算机上,但它似乎不在我的库缓存中。我尝试使用ldconfig,但问题仍然存在。关于如何解决这个问题有什么想法吗?

确保
libtanlib_core.so
所在的目录配置在
/etc/ld.so.conf
(或
/etc/ld.so.conf.d/
)中,否则
ldconfig
将找不到它。

我怀疑这是配置问题。如何“确保在/etc/ld.so.conf中配置了libtanlib_core.so所在的目录”?。你能解释一下我将如何把这个目录放在ld.so.conf中吗?。我只是手动编辑文件,还是需要使用工具?