现在的位置: 首页 > 综合 > 正文

linux下编译jrtplib、jthreadlib

2018年02月06日 ⁄ 综合 ⁄ 共 1300字 ⁄ 字号 评论关闭

1.在官方网站下载最新的jrtplib、jthreadlib和cmake源码

        我使用的是当前最新的版本:jrtplib-3.9.1、jthreadlib-1.3.1、cmake-2.8.8

 

2.如果主机上没有安装过cmake,请先下载安装最新的cmake版本,最新的jrtplib、jthreadlib需要通过cmake来安装。

        因为我的主机上没有安装cmake,所以在这里我要先安装它。

        ①解压cmake压缩包,并进入cmake根目录。

        ②执行make&&make install命令。

        安装完成后,使用cmake -version来检查一下cmake的版本

 

        如果你的主机上已经安装过cmake但是版本比较旧,不能正确安装,那么请更新你的cmake。

       

3.安装jthreadlib

        进入jthreadlib目录

        首先执行

        #cmake .    (生成makefile文件)

        然后       

        #make&&make install

 

4.安装jrtplib

        进入jrtplib目录

        首先执行

        #cmake .    (生成makefile文件)

        然后       

        #make&&make install

 

5.装好以后系统环境如下,静态动态库安装到了/usr/local/lib目录下,包括libjrtplib-3.9.1.solibjthread-1.3.1.so等。头文件在/usr/local/include目录jrtplib3和jthread目录下。

 

6.在jrtplib的源代码目录里有例子程序,试验一下examples/example1.cpp,编译语句如下:

    如果安装正确,此时源码包中会出现编译好的测试程序example1,使用命令#./example1执行

    测试效果如下:

[root@localhost examples]# ./example1
Enter local portbase:
5000

Enter the destination IP address
127.0.0.1
Enter the destination port
5000

Number of packets you wish to be sent:
10

Sending packet 1/10

Sending packet 2/10
Got packet !

Sending packet 3/10
Got packet !
Got packet !

Sending packet 4/10
Got packet !

Sending packet 5/10
Got packet !

Sending packet 6/10
Got packet !

Sending packet 7/10
Got packet !

Sending packet 8/10
Got packet !

Sending packet 9/10
Got packet !

Sending packet 10/10
Got packet !
[root@localhost examples]#

 

 

抱歉!评论已关闭.