当前位置:网站首页>ROS中编译通过但是遇到可执行文件找不到的问题
ROS中编译通过但是遇到可执行文件找不到的问题
2022-08-03 11:45:00 【MrandMis】
编写一个ros package,catkin_make编译后却无法Tab补全包内的节点名称双击Tab甚至没有任何可执行节点信息,手动写全也出现如下错误:
[rosrun] Couldn't find executable named XXXXXXXXXXXX问题出在add_executable()以及target_link_libraries()出现的位置。
值得注意的是第一段代码的位置一定要在第二段之前,否则在devel/lib里面是无法生成编译后的文件的。
# Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
add_executable(basic_shapes src/basic_shapes.cpp)
target_link_libraries(basic_shapes ${catkin_LIBRARIES})
add_executable(points_and_lines src/points_and_lines.cpp)
target_link_libraries(points_and_lines ${catkin_LIBRARIES})最后位置正确的效果如下述代码。
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES using_markers
# CATKIN_DEPENDS roscpp visualization_msgs
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/using_markers.cpp
# )
## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/using_markers_node.cpp)
## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# catkin_install_python(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
add_executable(basic_shapes src/basic_shapes.cpp)
target_link_libraries(basic_shapes ${catkin_LIBRARIES})
add_executable(points_and_lines src/points_and_lines.cpp)
target_link_libraries(points_and_lines ${catkin_LIBRARIES})再次catkin_make就可以看到结果了。

边栏推荐
猜你喜欢
随机推荐
增加WebView对localStorage的支持
CDH6.3.2开启kerberos认证
永寿 永寿农特产品-苹果
opencv学习—VideoCapture 类基础知识「建议收藏」
学习软件测试需要掌握哪些知识点呢?
bash if conditional judgment
记住用户名案例(js)
Blazor Server(6) from scratch--policy-based permission verification
viewstub 的详细用法_pageinfo用法
通过组策略安装软件和删除用户配置文件
【MySQL功法】第2话 · 数据库与数据表的基本操作
从零开始Blazor Server(6)--基于策略的权限验证
进程内存
Matlab学习13-图像处理之可视化GUI程序
"Digital Economy Panorama White Paper" Financial Digital User Chapter released!
深度学习中数据到底要不要归一化?实测数据来说明!
基于Sikuli GUI图像识别框架的PC客户端自动化测试实践
PC client automation testing practice based on Sikuli GUI image recognition framework
实现2d人物在跳跃的同时左右移动
基于Sikuli GUI图像识别框架的PC客户端自动化测试实践









