/usr/bin/ld:找不到 [英] /usr/bin/ld: cannot find

查看:1519
本文介绍了/usr/bin/ld:找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个.so文件并将其放置在/opt/lib位置,并在此之后在尝试使用以下命令编译主程序时将此路径添加到LD_LIBRARY_PATH:

I created a .so file and put it in the location /opt/lib and added this path to LD_LIBRARY_PATH now after this when I try to compile my main program with the following command:

g++ -Wall -I/home/alwin/Development/Calculator/ main.cpp -lcalc -o calculator

我收到以下错误:

/usr/bin/ld: cannot find -lcalc
collect2: ld returned 1 exit status

有人可以帮我这个忙吗? 我使用代码块IDE创建了共享库

Can someone help me with this. I created the shared library using the code blocks IDE

推荐答案

在您的编译器参数中添加-L/opt/lib,这使编译器和链接器在该文件夹中搜索libcalc.so的路径.

Add -L/opt/lib to your compiler parameters, this makes the compiler and linker search that path for libcalc.so in that folder.

这篇关于/usr/bin/ld:找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆