Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/126.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
C++ 如何消除ubuntu中的ld错误_C++_Ubuntu - Fatal编程技术网

C++ 如何消除ubuntu中的ld错误

C++ 如何消除ubuntu中的ld错误,c++,ubuntu,C++,Ubuntu,运行make命令后,我遇到以下错误: /usr/bin/ld: cannot find -lGLESv2 /usr/bin/ld: cannot find -lepoxy /usr/bin/ld: cannot find -lEGL /usr/bin/ld: cannot find -lGLESv2 /usr/bin/ld: cannot find -lepoxy /usr/bin/ld: cannot find -lEGL /usr/bin/ld: cannot find -lGLESv2 /

运行
make
命令后,我遇到以下错误:

/usr/bin/ld: cannot find -lGLESv2
/usr/bin/ld: cannot find -lepoxy
/usr/bin/ld: cannot find -lEGL
/usr/bin/ld: cannot find -lGLESv2
/usr/bin/ld: cannot find -lepoxy
/usr/bin/ld: cannot find -lEGL
/usr/bin/ld: cannot find -lGLESv2
/usr/bin/ld: cannot find -lepoxy
/usr/bin/ld: cannot find -lEGL
/usr/bin/ld: cannot find -laio
/usr/bin/ld: cannot find -lcurl
/usr/bin/ld: cannot find -lssh2
/usr/bin/ld: cannot find -lncursesw
/usr/bin/ld: cannot find -lSDL
collect2: error: ld returned 1 exit status
main/CMakeFiles/esesc.dir/build.make:163: recipe for target 'main/esesc' failed
make[2]: *** [main/esesc] Error 1
CMakeFiles/Makefile2:1041: recipe for target 'main/CMakeFiles/esesc.dir/all' failed
make[1]: *** [main/CMakeFiles/esesc.dir/all] Error 2
Makefile:75: recipe for target 'all' failed
make: *** [all] Error 2
我已尝试在线搜索这些链接:

在这里,我看到每个库都必须与现有库进行象征性的链接,但我不确定是否要这样做。有谁能给我推荐一下做这件事的技巧吗


我知道
locate
ln
命令。现在,如何使用该工具消除上述错误?有人能详细说明一下吗?提前感谢。

这意味着您没有安装所需的依赖项。 您是否至少安装了本手册中的LIB


应该删除环氧树脂警告,例如,

您的link命令可能需要在-L之前加上-L

在系统中搜索那些libname,例如GLESv2

我使用“定位GLESv2”。(注意:locate使用“sudo updatedb”更新的内容)

在我的Unbuntu中,以下行由locate报告

> /usr/lib/x86_64-linux-gnu/libGLESv2.so
> /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so
> /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so.2
> /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so.2.0.0
对于在第一个dir中找到的so(共享对象库),您可以尝试将以下内容添加到build命令中

-L/usr/lib/x86_64-linux-gnu
并对任何尚未解析的库名称重复

下面是我的Makefile中的一个示例—请注意我在目录“bag”中编写的库集合的相对路径


R01:dtb_acs.cc
rm-f dtb_acs
g++-m64-O3-ggdb-std=c++14-wallwextra-Wshadow-Wnon虚拟dtor
-学究式-Wcast对齐-Wcast质量-Wconversion-Wpointer arith-Wunused
-Woverloaded虚拟机
-O0 dtb_acs.cc-o dtb_acs
-L..//袋子-lbag_i686-lposix_i686-lrt-pthread
^^^^^^^^^^^三个-l在-l方向

如果需要(因为该工作没有解决任何问题),请尝试添加-l和特定库,例如-llibGLESv2.so(或.a,视情况而定)

祝你好运。

在/usr/lib/x86_64-linux-gnu中有很多.so库。
-L/usr/lib/x86_64-linux-gnu
R01: dtb_acs.cc 
rm -f dtb_acs 
g++ -m64 -O3 -ggdb -std=c++14 -Wall-Wextra -Wshadow -Wnon-virtual-dtor
 -pedantic -Wcast-align -Wcast-qual -Wconversion -Wpointer-arith -Wunused
 -Woverloaded-virtual   
  -O0   dtb_acs.cc  -o dtb_acs  
 -L../../bag -lbag_i686 -lposix_i686 -lrt -pthread
 ^^^^^^^^^^^ three -l<libname> are in the -L dir