zoukankan      html  css  js  c++  java
  • QT Cmake添加srv和msg

    1 CmakeLists.txt

    cmake_minimum_required(VERSION 2.8.3)
    project(map_msgs)
    
    find_package(catkin REQUIRED
      COMPONENTS
        std_msgs
        sensor_msgs
        nav_msgs
        message_generation
    )
    
    add_message_files(
      FILES
    NaviStatusCode.msg
    NaviStatusResponse.msg
    )
    add_service_files(
      FILES
    String.srv
    NaviStatusSwitch.srv
    )
    
    generate_messages(
      DEPENDENCIES
        std_msgs
        sensor_msgs
        nav_msgs
    )
    
    catkin_package(
      CATKIN_DEPENDS
        std_msgs
        message_runtime
        sensor_msgs
        nav_msgs
    )
    
    install(
      DIRECTORY include/${PROJECT_NAME}/
      DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
      FILES_MATCHING PATTERN "*.h"
    )

    2 package.xml

    <package>
        <name>map_msgs</name>
        <version>1.13.0</version>
        <description>  This package defines messages commonly used in mapping packages</description>
        <author>Unknow</author>
        <maintainer email="Unknow@126.com">Unknow</maintainer>
        <license>Unknow</license>
    
        <buildtool_depend>catkin</buildtool_depend>
    
        <build_depend>message_generation</build_depend>
        <build_depend>std_msgs</build_depend>
        <build_depend>sensor_msgs</build_depend>
        <build_depend>nav_msgs</build_depend>
    
        <run_depend>message_runtime</run_depend>
        <run_depend>std_msgs</run_depend>
        <run_depend>sensor_msgs</run_depend>
        <run_depend>nav_msgs</run_depend>
    
    </package>

    3链接常见错误

    如果在工程中添加消息或者服务,头文件依赖其生成的头文件,直接编译会报错,必须在CmakeLists.txt中添加以下依赖 generate_messages_cpp,生成可执行程序之前首先编译生成消息头文件

    add_dependencies(${PROJECT_NAME}
        ${catkin_EXPORTED_TARGETS}
        ${PROJECT_NAME}_generate_messages_cpp
    )





  • 相关阅读:
    盒模型--边界
    盒模型--填充
    盒模型--宽度和高度
    盒模型--边框(二)
    盒模型--边框(一)
    元素分类--内联块状元素(特点:同行, 可设置宽高和边距)
    元素分类--内联元素(特点:同行, 宽高边距不可改)
    元素分类--块级元素(特点:独占一行, 宽高边距可改)
    Java并发注解Annotation
    游戏服务器端开发的基本大纲
  • 原文地址:https://www.cnblogs.com/zx-hit/p/14235441.html
Copyright © 2011-2022 走看看