Ubuntu下设置外部库运行环境:
1.Create path /home/ubuntu/lib;
2.Copy the dynamic library files (SO files) into the path;
3.在/etc/ld.so.conf中加入/home/ubuntu/lib这一行,保存之后,再运行:/sbin/ldconfig –v更新一下配置即可。
ROS中使用外部库编译:
可以参考http://wiki.ros.org/rosbuild/CMakeLists/Examples#LinkingOther
在CMakeLists.txt 中添加入下:
link_directories(/home/ubuntu/lib)
rosbuild_add_executable(Camera3D_R32 src/Camera3D.cpp)
target_link_libraries(Camera3D_R32 libOpenNI2.so)
如有问题请参考:http://answers.ros.org/question/11294/a-problem-of-linking-external-libraries/