Search code examples
c++ubuntu-16.04qt-creatorrealsense

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. My .pro file looks like the following

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. I get this error error: cannot find -lrealsense2 . The folder /usr/lib/x86.... contains the file librealsense2.so enter image description here but its in red. Please help...where am I doing it wrong


Solution

  • It seems that there is some error with your installation. I checked with Ubuntu 16.04 and 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

    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.

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