简体   繁体   English

无法在 qt creator 上链接 c++ 上的 realsense 库

[英]Cannot link realsense library on c++ on qt creator

I am trying basic C++ programs with Intel Realsense sdk2 with librealsense library on Qt Creator.我正在尝试在 Qt Creator 上使用带有librealsense库的 Intel Realsense sdk2 的基本 C++ 程序。 My .pro file looks like the following我的 .pro 文件如下所示

INCLUDEPATH += /home/magbot/opencv-3.4.8/build/include
LIBS += -L/home/magbot/opencv-3.4.8/build/lib \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgcodecs \

LIBS += -L/usr/lib/x86_64-linux-gnu -lrealsense2 \

SOURCES += \
    main.cpp

OpenCV libraries compile fine but the realsense library does not link. OpenCV 库编译得很好,但 realsense 库没有链接。 I get this error error: cannot find -lrealsense2 .我收到此错误错误:找不到 -lrealsense2 The folder /usr/lib/x86.... contains the file librealsense2.so文件夹 /usr/lib/x86.... 包含文件 librealsense2.so 在此处输入图片说明 but its in red.但它是红色的。 Please help...where am I doing it wrong请帮助...我在哪里做错了

It seems that there is some error with your installation.您的安装似乎存在一些错误。 I checked with Ubuntu 16.04 and 18.04.我检查了 Ubuntu 16.04 和 18.04。 Both installation looks fine installed via package manager.通过包管理器安装的两个安装看起来都很好。

You should try reinstalling it.您应该尝试重新安装它。 If you want to install it with package manager(apt-get) follow this如果你想用包管理器(apt-get)安装它,请遵循这个

If you are installing from source code that follow this如果您从遵循此的源代码安装

As mention in comment by KamilCuk , you can also try to remove dead symbolic link and then create new one.正如KamilCuk在评论中提到的,您还可以尝试删除无效的符号链接,然后创建新的符号链接。

rm /usr/lib/x86.../librealsense2.so
ln -s /usr/lib/x86.../librealsense2.so.2.30 /usr/lib/x86.../librealsense2.so

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

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