1.编译成静态库。
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