当前位置:网站首页>ROS compilation calls the third-party dynamic library (xxx.so)
ROS compilation calls the third-party dynamic library (xxx.so)
2022-07-06 08:35:00 【Will_ Ye】
1. Problem
In the process of doing the project , Inevitable , Sometimes you need to use some third-party open source libraries , Or write your own dynamic library , Then you need to CMakeLists Add the path corresponding to these dynamic libraries , Compile .
The suffix of the dynamic library that needs to be called is generally .so, Sometimes I will encounter something except libxxx.so, also libxxx.so.x and libxxx.so.x.y.z these , Such as libzzz.so, also libzzz.so.1 and libzzz.so.1.0.0
In the suffix .so These figures after , In fact, it represents different versions , Used for version management , So the file name of the whole dynamic library is exquisite . such as libzzz.so.1.2.3,lib It is a fixed representative shared library ,zzz Is the shared library name ,.so Is a fixed suffix ,1 Indicates the major version number ,2 Indicates the minor version number ,3 Indicates the release version number .
The major version number : Incompatibility between different version numbers
Sub version number : Incremental upgrade , Backward compatibility
Release number : Error correction and performance improvement corresponding to the next version , Does not affect compatibility
And the longest name libxxx.so.x.y.z, Is the actual library file , It contains executable binary code . So you can use instructions readelf -d libzzz.so.1.2.3 Read this file .
In fact, when generating the Library , You can also directly generate only one libzzz.so As the actual library file , It depends on the individual , The standard point is that we should do a good job in library version management .
2. Method
stay ROS Of package in , Generally, two folders are created (include and lib), Deposit .h The header file and .so Dynamic library files , therefore , We just put the third-party dynamic library files into lib In the folder , Don't forget to put the relevant libxxx.so.x and libxxx.so.x.y.z Also put it in , No one can do without .

After the dynamic library file is placed , Revise it CMakeList That's all right.
cmake_minimum_required(VERSION 2.8.3)
SET(CMAKE_BUILD_TYPE Debug)
add_compile_options( -std=c++11)
project(gazebo_mobile_manipulator)
find_package(PCL 1.8 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(catkin REQUIRED COMPONENTS
nav_msgs
roscpp
rospy
serial
tf
std_msgs
std_srvs
actionlib
actionlib_msgs
message_generation
geometry_msgs
pcl_conversions
pcl_ros
PCL
)
catkin_package(
CATKIN_DEPENDS roscpp rospy serial std_msgs message_runtime
INCLUDE_DIRS include
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
link_directories(
${catkin_LIB_DIRS} lib
)
add_executable(test src/test1.cpp)
target_link_libraries(test ${PCL_LIBRARIES} ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} libzzz.so)
Pay attention to the last line , stay target_link_libraries Inside , Just add libzzz.so That's all right. , There is no need to add the version number that follows , adopt .so This will search for others .
then catkin_make Just compile it
边栏推荐
- 企微服务商平台收费接口对接教程
- Online yaml to CSV tool
- Report on Market Research and investment prospects of China's silver powder industry (2022 Edition)
- egg. JS directory structure
- Precise query of tree tree
- Sublime text using ctrl+b to run another program without closing other runs
- Trying to use is on a network resource that is unavailable
- leetcode刷题 (5.31) 字符串
- 生成器参数传入参数
- MySQL learning records 12jdbc operation transactions
猜你喜欢

Bottom up - physical layer

PC easy to use essential software (used)

PLT in Matplotlib tight_ layout()

Roguelike游戏成破解重灾区,如何破局?

【MySQL】鎖

【MySQL】锁

Pointer advanced --- pointer array, array pointer

化不掉的钟薛高,逃不出网红产品的生命周期

2022.02.13 - NC002. sort

2022 Inner Mongolia latest construction tower crane (construction special operation) simulation examination question bank and answers
随机推荐
Sort according to a number in a string in a column of CSV file
hutool优雅解析URL链接并获取参数
MySQL learning records 12jdbc operation transactions
[secretly kill little partner pytorch20 days -day01- example of structured data modeling process]
sublime text的编写程序时的Tab和空格缩进问题
swagger设置字段required必填
电脑F1-F12用途
Modify the video name from the name mapping relationship in the table
Analysis of the source code of cocos2d-x for mobile game security (mobile game reverse and protection)
Colorlog combined with logging to print colored logs
pcd转ply后在meshlab无法打开,提示 Error details: Unespected eof
Wincc7.5 download and installation tutorial (win10 system)
【MySQL】锁
C語言雙指針——經典題型
The resources of underground pipe holes are tight, and the air blowing micro cable is not fragrant?
从表中名称映射关系修改视频名称
[luatos-air551g] 6.2 repair: restart caused by line drawing
Day29-t77 & t1726-2022-02-13-don't answer by yourself
2. File operation - write
marathon-envs项目环境配置(强化学习模仿参考动作)