GStreamer - 使用RTSP服务器进行编译

时间:2018-04-18 19:47:51

标签: c gcc gstreamer rtsp

我正在尝试使用rtsp-server编译gstreamer程序。我已经包含了必要的头文件,并在尝试编译后得到此错误。

In function `main':
stream.c:(.text+0x36): undefined reference to `gst_rtsp_server_new'
stream.c:(.text+0x46): undefined reference to `gst_rtsp_server_get_mount_points'
stream.c:(.text+0x4f): undefined reference to `gst_rtsp_media_factory_new'
stream.c:(.text+0x64): undefined reference to `gst_rtsp_media_factory_set_launch'
stream.c:(.text+0x75): undefined reference to `gst_rtsp_media_factory_set_shared'
stream.c:(.text+0x8a): undefined reference to `gst_rtsp_mount_points_add_factory'
stream.c:(.text+0xa7): undefined reference to `gst_rtsp_server_attach'
collect2: error: ld returned 1 exit status

我尝试基于以下几种方式编译程序:

Gst RTSP server programming

Gstreamer rtsp server linking in Qt Creator

我使用的确切gcc命令是:

gcc stream.c -o stream `pkg-config --cflags --libs gstreamer-rtsp-1.0 gstreamer-1.0`

gcc `pkg-config gstreamer-1.0 gstreamer-rtsp-1.0 --cflags` stream.c -o stream `pkg-config gstreamer-1.0 gstreamer-rtsp-1.0 --libs`

任何帮助都会很棒,谢谢!

1 个答案:

答案 0 :(得分:1)

找到解决方案,显然我是以错误的方式使用pkg-config。我使用的新gcc命令是:

 gcc stream.c -o stream $(pkg-config --cflags --libs gstreamer-rtsp-server-1.0 gstreamer-1.0)