Compiling the following program
#include "jrtplib3/rtpsession.h"
#include "jrtplib3/rtpudpv4transmitter.h"
#include "jrtplib3/rtpipv4address.h"
#include "jrtplib3/rtpsessionparams.h"
#include "jrtplib3/rtperrors.h"
#include "jrtplib3/rtplibraryversion.h"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
using namespace jrtplib;
void checkerror(int rtperr)
{
if (rtperr < 0)
{
std::cout << "ERROR: " << RTPGetErrorString(rtperr) << std::endl;
exit(-1);
}
}
int main(void){
return 0;
}
with
g++ -o ex1 ex1.cpp
throws me the following error:
/tmp/ccDU6m7Y.o: In function `checkerror(int)':
ex1.cpp:(.text+0x2e): undefined reference to `jrtplib::RTPGetErrorString[abi:cxx11](int)'
collect2: error: ld returned 1 exit status
even though my LD_LIBRARY_PATH
is set to /usr/local/lib
and the folder contains the necessary libraries:
libjrtp.a
libjrtp.so
libjrtp.so.3.11.1
I compiled jthread
as well as jrtplib
with
mkdir build
cd build
cmake ..
sudo all make
I also figured out that the examples from the jrtplib
compiled successfully. My code example is a snippet from example1. Unfortunately, I couldn't figure out where the difference lies.
I think the answer to my problem is quite simple.