当前位置:   article > 正文

c++(1):c++编译报错汇总_error: call of overloaded 'asin(double)' is ambigu

error: call of overloaded 'asin(double)' is ambiguous if (fabs(asin(dheight/

记录一些c++编译报错的细节:

1 报错:error: ‘isnan’ was not declared in this scope

        在cpp文件中添加

  1. #include <math.h> //hxz
  2. using namespace std; //hxz

2 error: reference to ‘map’ is ambiguous

  1. /home/meng/Desktop/yellow/C2planner/src/ptm2ogm_v3/src/ptm2ogm.cpp:323:5: error: reference to ‘map’ is ambiguous
  2. map.header.frame_id=world_frame;
  3. ^
  4. /home/meng/Desktop/yellow/C2planner/src/ptm2ogm_v3/src/ptm2ogm.cpp:61:25: note: candidates are: nav_msgs::OccupancyGrid map
  5. nav_msgs::OccupancyGrid map;
  6. ^
  7. In file included from /usr/include/c++/5/map:61:0,
  8. from /opt/ros/kinetic/include/ros/console.h:42,
  9. from /opt/ros/kinetic/include/ros/ros.h:40,
  10. from /home/meng/Desktop/yellow/C2planner/src/ptm2ogm_v3/src/ptm2ogm.cpp:1:
  11. /usr/include/c++/5/bits/stl_map.h:96:11: note: template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map
  12. class map
  13. ^

        这里是与c++的库/usr/include/c++/5/bits/stl_map.h:96:11有冲突

        修改自己定义的变量名如下,并在使用位置相应修改:

  1. // nav_msgs::OccupancyGrid map;
  2. nav_msgs::OccupancyGrid map_;

        这里需要注意以下:map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据 处理能力,由于这个特性,它完成有可能在我们处理一对一数据的时候,在编程上提供快速通道。

        我的cpp中使用如下:

  std::map<std::pair<int, int>, std::vector<double>> gridMap;

3 call of overloaded ‘abs(double)’ is ambiguous

  1. /home/xxxxapollo_speed/math.hpp:18:25: error: call of overloaded ‘abs(double)’ is ambiguous
  2. if (std::abs(t1 - t0) <= 1.0e-6)
  1. /home/xxxxxx.cpp:25:39: error: call of overloaded ‘abs(const double&)’ is ambiguous
  2. s_ddot_min_(-std::abs(s_ddot_min)),

        修改,在对应头文件添加:

#include <cmath>

        这里有说明:g++编译时abs()遇到无法理解的问题(已解决)_梧桐下的四叶草的博客-CSDN博客

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/104833
推荐阅读
相关标签
  

闽ICP备14008679号