红联Linux门户
Linux帮助

linux下编译raknet

发布时间:2015-10-30 15:28:39来源:linux网站作者:L_yangliu

下载地址:http://www.raknet.com/raknet/downloads


1.编译成静态库。

cd Soure
g++ -c *.cpp
ar rc libraknet.a *.o
g++ -shared -O3 -fPIC -o libraknet.so.0.0.0 *.cpp


2.将生成的库文件拷贝到系统库下

cp libraknet.so.0.0.0 libraknet.a /usr/local/lib/


3.建立连接

ln -s /usr/local/lib/libraknet.so.0.0.0 /usr/local/lib/libraknet.so.0
ln -s /usr/local/lib/libraknet.so.0.0.0 /usr/local/lib/libraknet.so


4.创建头文件目录

mkdir /usr/local/include/raknet


5.将所有的头文件拷贝到目录下

cp *.h  /usr/local/include/raknet


6.执行命令

ldconfig


7.编译例子
g++ testraknet.cpp -o raknet /usr/local/lib/libraknet.so -lpthread