项目场景:
ubuntu 编译c语言程序 链接出现错误
问题描述:
/bin/ld: 找不到- lwiringPi
returned 1 exit status
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520165555867.png)
原因分析:
缺少对于lib库文件
解决方案:
1.打开文件 在顶部搜索 相应的lib文件
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520165804182.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ3MTcxNjg1,size_16,color_FFFFFF,t_70)
2. 打开文件位置
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520170033888.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ3MTcxNjg1,size_16,color_FFFFFF,t_70)
或者直接 locate libwiringPi.so
3.找到对应路径
点击用终端打开
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520171245354.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ3MTcxNjg1,size_16,color_FFFFFF,t_70)
4.建立软链接
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520170304233.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ3MTcxNjg1,size_16,color_FFFFFF,t_70)
sudo ln -s /usr/lib/aarch64-linux-gnu/libwiringPi.so.2.50 /usr/lib/libwiringPi.so
相应路径可以按实际改变
最后再执行编译代码即可