本文介绍了在树莓中交叉编译qt中构建应用程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我试图在树莓派中编译和应用一个交叉编译的 qt5 。 此应用程序基于此 rf24l01 库。当我从RPi编译一个 cpp 程序,一切正常,但当我尝试从我的电脑运行 ubuntu 12.04(32bits)以下错误是通过:I'm trying to build and app on a cross-compiled qt5 in a raspberry pi.This app is based on this rf24l01 library. When I compile a cpp program from the RPi, everything works fine, but when I tried from my pc running ubuntu 12.04 (32bits) the following error is through:error: cannot find -lrf24-bcm我在专业文件中使用这一行指向库:I point to the library using this line in the pro file:LIBS += -L/mnt/rpi/usr/local/lib -lrf24-bcm AFAIK,这是lib所在的路径:AFAIK, this is the path where the lib is located:这是`ls / mnt / rpi / usr / local /This is the result of `ls /mnt/rpi/usr/local/lib:librf24-bcm.so libwiringPiDev.so libwiringPi.so.2.0librf24-bcm.so.1 libwiringPiDev.so.2.0 python2.6librf24-bcm.so.1.0 libwiringPi.so python2.7最后,这是详细出现的错误:Finally, this is the appeared error in detail: /home/atron/opt/gcc-4.7-linaro-rpi-gnueabihf / bin / arm-linux-gnueabihf-g ++ -Wl,-rpath- Tutorials link,/ mnt / rpi / opt / vc / lib -Wl,-rpath-link,/ mnt / rpi / usr / lib / arm -linux-gnueabihf -Wl,-rpath- Tutorials link,/ mnt / rpi / lib / arm-linux-gnueabihf --sysroot = / mnt / rpi -Wl,-rpath,/ usr / local / opt / lib -o homekit main.o -L / mnt / rpi / usr / local / lib -lrf24-bcm -L / mnt / rpi / usr / local / opt / lib -lQt5Network -L / usr / local / opt / lib -lQt5Core -lpthreadã /home/atron/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../。 ./../../arm-linux-gnueabihf/bin/ld:找不到-lrf24-bcm collect2:error:ld returned 1 exit status /home/atron/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -Wl,-rpath-link,/mnt/rpi/opt/vc/lib -Wl,-rpath-link,/mnt/rpi/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/mnt/rpi/lib/arm-linux-gnueabihf --sysroot=/mnt/rpi -Wl,-rpath,/usr/local/opt/lib -o homekit main.o -L/mnt/rpi/usr/local/lib -lrf24-bcm -L/mnt/rpi/usr/local/opt/lib -lQt5Network -L/usr/local/opt/lib -lQt5Core -lpthread /home/atron/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lrf24-bcm collect2: error: ld returned 1 exit status我做错了什么?提前感谢,推荐答案我不知道这是否技术上正确,但解决了我的问题。 主要想法是创建库的符号链接到我的电脑 / usr / local / lib 文件夹:I don't know if this is "technically" correct, but solved my problem.The main idea is create a symbolic link of the library to my pc /usr/local/lib folder:sudo ln -s /mnt/rpi/usr/local/lib/librf24-bcm.so /usr/local/lib/librf24-bcm.sosudo ln -s /mnt/rpi/usr/local/lib/librf24-bcm.so.1 /usr/local/lib/librf24-bcm.so.1sudo ln -s /mnt/rpi/usr/local/lib/librf24-bcm.so.1.0 /usr/local/lib/librf24-bcm.so.1.0然后,在QT创建者 * pro 文件中,您只需要添加lib引用:Then, on QT creator *pro file you only need to add the lib reference:LIBS=-lrf24-bcm我希望这可以帮助一些新手喜欢我。 谨慎,I hope this could help to some newbie like me.Regards, 这篇关于在树莓中交叉编译qt中构建应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 15:03