CMakeLists与共享库有关

时间:2016-01-24 18:46:12

标签: c++ cmake gstreamer clion pkg-config

我试图通过这种方式使用gstreamer-rtsp-server:

  1. 我已下载gst-rtsp-server source,并照常使用./configuremakemake install进行编译和安装。
  2. 在此之后,我使用gstreamer-rtsp-server示例(gst-rtsp-server-1.6.0/examples/test-launch.c)中的代码创建简单的CLion项目
  3. CMakeLists看起来像这样:

    cmake_minimum_required(VERSION 3.3)
    project(gst_RTSP_server)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    include(FindPkgConfig)
    pkg_check_modules(GLIB glib-2.0 REQUIRED) 
    pkg_check_modules(GSTREAMER
        REQUIRED gstreamer-1.0) 
    pkg_check_modules(GSTRTSP
        gstreamer-rtsp-server-1.0)
    include_directories(${GLIB_INCLUDE_DIRS})
    include_directories(${GSTREAMER_INCLUDE_DIRS})
    include_directories(${GSTRTSP_INCLUDE_DIRS})
    set(SOURCE_FILES main.cpp) 
    add_executable(gst_RTSP_server ${SOURCE_FILES}) 
    target_link_libraries(${PROJECT_NAME} ${GLIB_LIBRARIES}) 
    target_link_libraries(${PROJECT_NAME} ${GSTREAMER_LIBRARIES}) 
    target_link_libraries(${PROJECT_NAME} gstvideo-1.0)
    target_link_libraries(${PROJECT_NAME} ${GSTRTSP_LIBRARIES})
    
  4. 毕竟我成功构建了我的项目,但是当我运行它时,我得到输出:

    error while loading shared libraries: libgstrtspserver-1.0.so.0:
    cannot open shared object file: No such file or directory
    

    如何修复它并运行我的项目?

0 个答案:

没有答案