usr/bin/ld: 找不到 -l<nameOfTheLibrary> [英] usr/bin/ld: cannot find -l<nameOfTheLibrary>
本文介绍了usr/bin/ld: 找不到 -l<nameOfTheLibrary>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试编译我的程序,但它返回此错误:
I'm trying to compile my program and it returns this error :
usr/bin/ld: cannot find -l<nameOfTheLibrary>
在我的 makefile 中,我使用命令 g++
并链接到我的库,这是指向位于其他目录中的库的符号链接.
in my makefile I use the command g++
and link to my library which is a symbolic link to my library located on an other directory.
请问有没有可以添加的选项以使其正常工作?
Is there an option to add to make it work please?
推荐答案
如果您的库名称是 libxyz.so
并且它位于路径上,请说:
If your library name is say libxyz.so
and it is located on path say:
/home/user/myDir
然后将其链接到您的程序:
then to link it to your program:
g++ -L/home/user/myDir -lxyz myprog.cpp -o myprog
这篇关于usr/bin/ld: 找不到 -l<nameOfTheLibrary>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文