Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: gst/gst.h: No such file or directory (using CMake)

I'm trying to build a C++ application with gstreamer using CMake. In my CMakeLists.txt file, gstreamer is included with the following lines:

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)

I can run cmake without any errors, but make gives the following error:

fatal error: gst/gst.h: No such file or directory

Gstreamer is installed and I have checked that the gst.h file is located at /usr/include/gstreamer-1.0/gst/gst.h along with the other gstreamer header files.

The following environment variables has been set:

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

I've also checked the output from pkg-config, suggested in another post with similar problem:

$ 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

So why can't the gstreamer header file be found?

(I'm new to both gstreamer and CMake)

like image 476
KMK Avatar asked Nov 20 '17 09:11

KMK


1 Answers

Turns out I didn't actually link the libraries to the application. Adding the following 2 lines to the CMakeLists.txt fixed the error (in case anyone else makes the same mistake as me):

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

(videoDemo is the name of the application)

like image 114
KMK Avatar answered Nov 15 '22 05:11

KMK