首页 > 技术文章 > 6.27-C++手记

lizhensheng 2019-07-01 23:31 原文

TOC

前言

  • 记下错误!

正文

  • 不要试图在CLion中对程序进行排错,只有在catkin_make后,CLion中才能够无错
  • rosconfig文件里面不能出现汉字编码,不然编译会报错
  • 注意std::string
  • ```#include "proxy.h"
  • ISO C++ forbids declaration of ‘ with no type [-fpermissive]

  • 头文件和实现文件的函数不符合
  • error: no matching function for call

  • 函数用错了,往往是参数错误
  • make zsProxy
  • 注意编译子标
  • 服务的回调函数返回类型必须为bool,订阅的回调函数返回类型必须为void
  • 回调函数记得用bind绑定
  • zs_pose_sub_ = nh_.subscribe("zs_pose", 1, (boost::function )boost::bind(&Proxy::reconfigParameterCB, this, _1 ));

  • 用tf函数记得include
  • include "tf/tf.h"

  • cannot convert ‘std::basic_string<char>’ to ‘const char*’

  • system(("rosrun dynamic_reconfigure dynparam set RosAria zsstart_pose_x " + start_pose_x_str_).c_str());
  • Undefined reference to ros::xx
  • 没有链接catkin_libraries
target_link_libraries(zsProxy
  ${catkin_LIBRARIES}
)
  • extra qualification ‘ProxyNode::’ on member ‘sendGoalCB’ [-fpermissive]
  • 在类定义中的函数声明中写了类名作用域

推荐阅读