srt: test-c-server example. undefined reference to `srt_startup', `srt_create_socket' and other

Hello, can you help me please? When I am compiling test-c-server, from examples, I am getting an error: gcc fork2.c -o fork /tmp/ccqhZ97y.o: In function main’: fork2.c:(.text+0x76): undefined reference to srt_startup' fork2.c:(.text+0x8c): undefined reference to srt_create_socket’ fork2.c:(.text+0xa4): undefined reference to srt_getlasterror_str' fork2.c:(.text+0x167): undefined reference to srt_setsockflag’ fork2.c:(.text+0x18f): undefined reference to srt_bind' fork2.c:(.text+0x1a7): undefined reference to srt_getlasterror_str' fork2.c:(.text+0x1ed): undefined reference to srt_listen’ fork2.c:(.text+0x205): undefined reference to srt_getlasterror_str’ fork2.c:(.text+0x261): undefined reference to srt_accept' fork2.c:(.text+0x2ab): undefined reference to srt_recvmsg’ fork2.c:(.text+0x2c3): undefined reference to srt_getlasterror_str' fork2.c:(.text+0x331): undefined reference to srt_close’ fork2.c:(.text+0x349): undefined reference to srt_getlasterror_str' fork2.c:(.text+0x37f): undefined reference to srt_cleanup’` collect2: error: ld returned 1 exit status

So what I did. I added a path to #include “srt/srt.h”, because without it I got an fatal error. Also I tried to use <> insteed “”, full path, nothing works… I installed srt on ubuntu 18 via git clone and make. sudo apt-get install tclsh pkg-config cmake libssl-dev build-essential git clone https://github.com/Haivision/srt ./configure make sudo make install Thank you in advance

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16

Most upvoted comments

Use export LD_LIBRARY_PATH="/usr/local/lib/

If so, then please make an installation package of SRT library first, then install it, and then use pkg-config to obtain appropriate cflags and libs for apps that depend on it.

Kinda

gcc fork2.c -o fork $(pkg-config --cflags --libs srt)

@UnderOverCovered The best way to build examples is to use cmake. cmake ./ -DENABLE_EXAMPLES=ON cmake --build ./ Or similar with configure: ./configure --enable-examples make