【问题标题】:Fatal error: gst/gst.h: No such file or directory (using CMake)致命错误:gst/gst.h:没有这样的文件或目录(使用 CMake)
【发布时间】:2018-05-03 10:53:55
【问题描述】:

我正在尝试使用 CMake 使用 gstreamer 构建 C++ 应用程序。在我的 CMakeLists.txt 文件中,gstreamer 包含在以下几行中:

find_package(PkgConfig REQUIRED)

pkg_search_module(GST REQUIRED gstreamer-1.0>=1.4
    gstreamer-sdp-1.0>=1.4
    gstreamer-video-1.0>=1.4
    gstreamer-app-1.0>=1.4)

我可以运行cmake 没有任何错误,但make 给出以下错误:

致命错误:gst/gst.h:没有这样的文件或目录

Gstreamer 已安装,我已检查 gst.h 文件是否位于 /usr/include/gstreamer-1.0/gst/gst.h 以及其他 gstreamer 头文件。 p>

已设置以下环境变量:

export PKG_CONFIG_PATH=/opt/qt-5.9.1/lib/pkgconfig
export LD_LIBRARY_PATH=/opt/qt-5.9.1/lib
export GST_PLUGIN_PATH=/usr/include/gstreamer-1.0

我还检查了 pkg-config 的输出,在另一篇有类似问题的帖子中建议:

$ pkg-config --cflags gstreamer-1.0
-pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/glib-2.0 -I/usr/x86_64-linux-gnu/glib-2.0/include

那么为什么找不到gstreamer头文件呢?

(我是 gstreamer 和 CMake 的新手)

【问题讨论】:

  • pkg_search_module 设置变量,其中包含包含目录和有关库的其他内容。你在CMakeLists.txt 中使用过这些变量吗?有关在 CMake 中使用 pkg-config 变量的信息,请参阅 that my post。

标签: c++ cmake gstreamer


【解决方案1】:

原来我实际上并没有将库链接到应用程序。将以下 2 行添加到 CMakeLists.txt 修复了错误(以防其他人与我犯同样的错误):

target_include_directories(videoDemo PRIVATE ${GST_INCLUDE_DIRS})
target_link_libraries(videoDemo ${GST_LIBRARIES})

(videoDemo是应用的名字)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-07-21
    • 2022-01-18
    • 1970-01-01
    • 2017-05-09
    • 2021-05-15
    • 2014-10-31
    • 2022-01-11
    相关资源
    最近更新 更多