jrtplib的安装和使用

来源:互联网 发布:杜兰特首秀数据 编辑:程序博客网 时间:2024/05/22 06:50

jrtplib下载地址:http://research.edm.uhasselt.be/~jori/page/index.php?n=CS.Jrtplib

解压:
tar -zxvf xxxx.tar.gz

进入到 jrtplib-3.9.1,阅读README.TXT,可以知道如何使用这个jrtplib
root@ubuntu:~ cmake ./

检测到系统没有安装cmake,
root@ubuntu:~ apt-get install cmake

安装完毕后,执行cmake
root@ubuntu:~ cmake ./root@ubuntu:~ makeroot@ubuntu:~ make install

就会在
usr/local/include看到rtp头文件
/jrtplib-3.9.1
在usr/local/lib看到库文件

编写测试程序:

//testrtcp.cpp#include "rtpsession.h"#include "rtpudpv4transmitter.h"#include "rtpipv4address.h"#include "rtperrors.h"#include "rtpsessionparams.h"using namespace jrtplib;int main(void){     RTPSession sess;     RTPSessionParams sessparams;     RTPUDPv4TransmissionParams transparams;     sessparams.SetOwnTimestampUnit(1.0/10.0);     sessparams.SetAcceptOwnPackets(true);     transparams.SetPortbase(8888);     sess.Create(sessparams,&transparams);     return 0;}

//makefile

#!\bin\shCC = g++RM = rmRTPLIBDIR = /usr/localINC = $(RTPLIBDIR)/include/jrtplib3LIB = $(RTPLIBDIR)/lib/CPPFLAGS = -Wall -I $(INC)LDFLAGS = -L $(LIB)LIBS = -ljrtp  LIBMODE = -staticTARGET = testrtpOBJ = testrtp.oSRC = testrtp.cpp$(TARGET):$(OBJ)     $(CC) $(CPPFLAGS) $(LDFLAGS)  $(LIBS) -o $(TARGET) $(OBJ)clean:     $(RM) -f $(OBJ) $(TARGET) 

编译:
root@ubuntu:~/work/test# makeg++  -Wall -I /usr/local/include/jrtplib3  -c -o testrtp.o testrtp.cppg++ -Wall -I /usr/local/include/jrtplib3 -L /usr/local/lib/  -ljrtp -o testrtp testrtp.o

运行程序:
root@ubuntu:~/work/test# ./testrtp./testrtp: error while loading shared libraries: libjrtp.so.3.9.1: cannot open shared object file: No such file or directory

无法找到库文件,解析:linux的应用程序加载动态链接库默认是在/usr/lib路径下,所以当程序运行的时候找链接库肯定找不到了,因为我们的链接库放在usr/local/lib。所以要正常运行就可以复制所要用到的库文件到/usr/lib路径下。





0 0
原创粉丝点击