Gst RTSP server programming

落爺英雄遲暮 提交于 2019-12-02 00:29:42

问题


I've installed gst-rtsp-server and I wanted to try a simple code. But on compilation I'm getting the following error:

In function `main':
test-launch01.c:(.text+0x64): undefined reference to `gst_rtsp_server_new'
test-launch01.c:(.text+0x74): undefined reference to `gst_rtsp_server_get_media_mapping'
test-launch01.c:(.text+0x7d): undefined reference to `gst_rtsp_media_factory_new'
test-launch01.c:(.text+0x95): undefined reference to `gst_rtsp_media_factory_set_shared'
test-launch01.c:(.text+0xad): undefined reference to `gst_rtsp_media_factory_set_launch'
test-launch01.c:(.text+0xc9): undefined reference to `gst_rtsp_media_mapping_add_factory'
test-launch01.c:(.text+0xe9): undefined reference to `gst_rtsp_server_attach'
collect2: ld returned 1 exit status

I've included the two headers. What am I missing?


回答1:


It appears that you have not linked to the lib. "Undefined reference" usually means that you have included the necessary header files but that the linker has not found the definitions.

Try adding:

`pkg-config gstreamer-rtsp-0.10 --libs` 

to your linker invocation.




回答2:


add gstreamer-rtsp-server-1.0 to pkg-config.




回答3:


After running

apt-get install libgstrtspserver-0.10-dev

the command

pkg-config --libs gstreamer-rtsp-0.10

returns

-pthread -lgstrtsp-0.10 -lgstreamer-0.10 -lgstsdp-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 

But

ls /usr/lib/libgstrtsp*

returns

/usr/lib/libgstrtspserver-0.10.so
/usr/lib/libgstrtspserver-0.10.so.0.0.0
/usr/lib/libgstrtspserver-0.10.so.0

So, replacing the flag -lgstrtsp-0.10 by -lgstrtspserver-0.10 solved this issue for me.




回答4:


Initially I was using the below command to compile when I also got similar errors

gcc -Wall test-server.c -o test-server $(pkg-config --cflags --libs gstreamer-1.0)

After reading comments above, it looked like not linking to gstreamer-rtsp-server-1.0 lib was the issue so I changed the command as below

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

NOTE: My build environment is Ubuntu 19.04



来源:https://stackoverflow.com/questions/7143581/gst-rtsp-server-programming

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!