Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Can't use libs after included



  • Hello,
    I am currently using QT Creator to create my own application. I created Project and chose Cmake
    This is my Cmakelist.txt:

    cmake_minimum_required(VERSION 2.8)
    
    project(RS15)
    find_package(PCL 1.8 REQUIRED)
    
    set (IMGUI_INCLUDE_DIRS "/home/nmhieu_brycenvn/Qt5/Test_File/imgui")
    set (IMGUI_DEFINITIONS "/home/nmhieu_brycenvn/Qt5/Test_File/imgui")
    
    include_directories(${IMGUI_INCLUDE_DIRS})
    include_directories(${PCL_INCLUDE_DIRS})
    link_directories(${PCL_LIBRARY_DIRS})
    add_definitions(${PCL_DEFINITIONS})
    add_definitions(${IMGUI_DEFINITIONS})
    
    add_executable(${PROJECT_NAME} "main.cpp")
    target_link_libraries (RS15 ${PCL_LIBRARIES})
    
    

    Not sure if I wrote Cmake correctly? I searched for hours to write it down, but the ImGui (a separated library) library couldn't be used, while PCL was fine.
    03753f27-d5f2-48cf-ac5d-7fd268d5ac01-image.png
    Can someone help me know how to include a separated library in file Cmake?
    Thanks for reading!!


  • Lifetime Qt Champion

    @Quys said in Can't use libs after included:

    target_link_libraries (RS15 ${PCL_LIBRARIES})

    You don't link against ImGui libs



  • @jsulm
    i added this to the cmakelist

    set (IMGUI_SOURCE "/home/nmhieu_brycenvn/librealsense/third-party/imgui")
    target_include_directories(RS15 PUBLIC ${IMGUI_SOURCE})
    

    But its still not working, am I wrong something?


  • Lifetime Qt Champion

    @Quys You don't link against ImGui libs
    You need to extend this line to link properly:

    target_link_libraries (RS15 ${PCL_LIBRARIES})
    

Log in to reply