简体   繁体   English

使链接器找到qt5

[英]Make linker find qt5

I am new to computing world. 我是计算机世界的新手。 I am trying to install iai kinect2 drivers but while executing the catkin_make -DCMAKE_BUILD_TYPE="Release" step I get the following error: 我正在尝试安装iai kinect2驱动程序,但是在执行catkin_make -DCMAKE_BUILD_TYPE="Release"步骤时,出现以下错误:

/usr/bin/ld: cannot find -lQt5::Core
/usr/bin/ld: cannot find -lQt5::Gui
/usr/bin/ld: cannot find -lQt5::Widgets
/usr/bin/ld: cannot find -lQt5::Test
/usr/bin/ld: cannot find -lQt5::Concurrent
/usr/bin/ld: cannot find -lQt5::OpenGL
collect2: error: ld returned 1 exit status
make[2]: *** [/home/pb/catkin_ws/devel/lib/libkinect2_registration.so] Error 1
make[1]: *** [iai_kinect2/kinect2_registration/CMakeFiles/kinect2_registration.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

After doing a lot of stackoverflowing I figured out that either the qt5 is not downloaded or downloaded in some other directory or conflicting with other version of qt4. 经过大量的堆栈溢出处理后,我发现qt5没有下载没有下载到其他目录中,或者与qt4的其他版本冲突。 Some of the pages on github also suggested a patch but that was for another package. github上的某些页面还建议了一个补丁,但这是另一个软件包。

I have already installed qt5 but in my home directory since I followed the steps on the Qt5 webpage . 自从按照Qt5网页上的步骤进行操作以来,我已经安装了qt5,但是在我的主目录中。 Now how can I add the path of installed Qt5 libraries so that the linker (ld) can find the required files. 现在如何添加已安装的Qt5库的路径,以便链接器(ld)可以找到所需的文件。

Useful links - Qt5 linker issue , Linker error cannot find lqt5::Widgets , similar error launchpad bug report 有用的链接-Qt5链接器问题链接器错误找不到lqt5 :: Widgets类似错误启动板错误报告

Note - I am using Ubuntu 14.04, in case you want me to update some $VAR then kindly suggest its name like $LIBRARY_DIR. 注意-我使用的是Ubuntu 14.04,以防您要我更新$ VAR,然后建议使用其名称,例如$ LIBRARY_DIR。 And if you want me to add the -DVAR='path' to catkin_make then also suggest a proper variable name that I need to add. 而且,如果您希望我将-DVAR ='path'添加到catkin_make,则还建议一个我需要添加的适当的变量名。

Thank you so much!! 非常感谢!! :D :d

What about just installing qtbase5-dev package (should be Qt 5.2.1 for Ubuntu 14.04): 仅安装qtbase5-dev软件包(对于Ubuntu 14.04应该是Qt 5.2.1)怎么样:

sudo apt-get install qtbase5-dev

instead of your installation of Qt5 ? 而不是安装Qt5

In case you prefer to just fix the library path you can add a file whatever.conf in /etc/ld.so.conf.d adding one or more rows with pathnames for the libraries. 如果你喜欢刚修好你可以添加一个文件whatever.conf库路径/etc/ld.so.conf.d添加一个或多个行与路径名的库。 After that, run ldconfig in there. 之后,在其中运行ldconfig

I had same problem. 我有同样的问题。
You can follow the steps given below for fixing the problem: 您可以按照以下步骤解决问题:

Firstly download the necessary libraries: 首先下载必要的库:

sudo apt-get install libqt5concurrent5
sudo apt-get install libqt5test5
sudo apt-get install libqt5core5a
sudo apt-get install libqt5opengl5
sudo apt-get install qtdeclarative5-dev

Then add these lines to '<consider-package>/CMakeLists.txt' : 然后将这些行添加到'<consider-package>/CMakeLists.txt'

find_package(Qt5Gui)
find_package(Qt5Core)
find_package(Qt5Widgets)
find_package(Qt5Test)
find_package(Qt5Concurrent)
find_package(Qt5OpenGL)

Finally do catkin_make . 最后做catkin_make

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM