ROS编译、运行出错汇总(持更)

1 .[FATAL] [1501048201.951595472]: You must call ros::init() before creating the first NodeHandle

2terminate called after throwing an instance of 'ros::InvalidNameException'

    what(): Character [-] at element [2] is not valid in Graph Resource Name [re-planning]. Valid characters are a-z, A-Z, 0-9, / and _.

3. fatal error: pathwithflag_msgs/PathWithFlag.h: 没有那个文件或目录
   #include <pathwithflag_msgs/PathWithFlag.h>

 4. symbol lookup error: ../../lib/libhogweed.so.2: undefined symbol: __gmpn_cnd_add_n

 


 

1.[FATAL] [1501048201.951595472]: You must call ros::init() before creating the first NodeHandle

  原因:可能有些全局变量的声明中用到了NodeHandle,例如,如果在ros::init()之前执行:

1 tf2_ros::Buffer tfBuffer;
2 tf2_ros::TransformListener tfListener(tfBuffer);

  就会提示上面的错误,因为在创建tf监听器时会用到NodeHandle,这可以在tf2_ros::TransformListener的定义文件中看到:

TransformListener(tf2::BufferCore& buffer, const ros::NodeHandle& nh, bool spin_thread = true);

2.terminate called after throwing an instance of 'ros::InvalidNameException'

what(): Character [-] at element [2] is not valid in Graph Resource Name [re-planning]. Valid characters are a-z, A-Z, 0-9, / and _.

原因,.cpp文件命名有问题,将re-planning改成re_planning就好了,我也不晓得为啥。

3.fatal error: pathwithflag_msgs/PathWithFlag.h: 没有那个文件或目录
   #include <pathwithflag_msgs/PathWithFlag.h>

  原因:当自定义msg文件之后,然后又在其他文件中使用了该自定义msg类型。因为catkin_make在编译的时候并不会指定pkg的编译顺序,

        所以在使用该msg的文件编译的时候新建的msg类型还没有编译,导致找不到头文件。

  解决:先编译包含新建msg的pkg,再编译其他pkg:

$ catkin_make -DCATKIN_WHITELIST_PACKAGES= "包名"
$ catkin_make -DCATKIN_WHITELIST_PACKAGES= "" //重新编译所有pkg

 4. symbol lookup error: ../../lib/libhogweed.so.2: undefined symbol: __gmpn_cnd_add_n

  Debugging this issue is quite simple. We know that the apt software can’t find the function __gmpn_cnd_add_n in the library libhogweed.so.2. This kind of errors almost always means that the library where the error occurs (libhogweed.so.2) expects a diffent version of a library it depends on (libgmp). Using ldd we can check which version is actually used:

$ ldd /usr/lib/x86_64-linux-gnu/libhogweed.so.2
[...]
libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f5ca1b59000)
[...]

We can clearly see that libgmp.so.10 from /usr/local/lib is used. This indicates that at some point someone installed a custom version of libgmp on the system that is different to the version installed by the package manager.

Usually we can simply remove /usr/local/lib/libgmp.so.10 which usually solves the problem because libhogweed starts to use the correct version as installed by the package manager. Beware, however, that other software using libgmp might stop to work because the library version changed. If removing the local library did not work, try re-checking using the method listed above.

 

posted on   zhch_pan  阅读(10302)  评论(0编辑  收藏  举报

编辑推荐:
· .NET Core GC计划阶段(plan_phase)底层原理浅谈
· .NET开发智能桌面机器人:用.NET IoT库编写驱动控制两个屏幕
· 用纯.NET开发并制作一个智能桌面机器人:从.NET IoT入门开始
· 一个超经典 WinForm,WPF 卡死问题的终极反思
· ASP.NET Core - 日志记录系统(二)
阅读排行:
· 在外漂泊的这几年总结和感悟,展望未来
· 博客园 & 1Panel 联合终身会员上线
· 支付宝事故这事儿,凭什么又是程序员背锅?有没有可能是这样的...
· https证书一键自动续期,帮你解放90天限制
· 在 ASP.NET Core WebAPI如何实现版本控制?
< 2025年1月 >
29 30 31 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 1
2 3 4 5 6 7 8

导航

统计

点击右上角即可分享
微信分享提示