Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in utils.h when compiling mavros using catkin build #64

Open
LyMing9 opened this issue Feb 19, 2024 · 2 comments
Open

Error in utils.h when compiling mavros using catkin build #64

LyMing9 opened this issue Feb 19, 2024 · 2 comments

Comments

@LyMing9
Copy link

LyMing9 commented Feb 19, 2024

Hello! Thank you very much for your project! I encountered an issue while following your installation process on GitHub. When using catkin build to compile, I received an error related to mavros. It seems that there is a redeclaration problem in the utils.h file. Could you please help me understand the cause of this error and provide a solution? Thank you very much!

Environment Information:

Operating System: Using VMware virtual machine, Ubuntu 18.04
ROS Version: Melodic
Unreal Engine: Not installed yet

Error Message:

In file included from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_sensor_orientation.cpp:17:0:
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:70:40: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(mavlink::common::MAV_AUTOPILOT e);
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:68:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::MAV_SENSOR_ORIENTATION)’
std::string to_string(mavlink::common::MAV_SENSOR_ORIENTATION e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:70:40: error: ‘MAV_AUTOPILOT’ is not a member of ‘mavlink::common’
std::string to_string(mavlink::common::MAV_AUTOPILOT e);
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:70:40: note: suggested alternative:
In file included from /opt/ros/melodic/include/mavlink/v2.0/common/../standard/standard.hpp:42:0,
from /opt/ros/melodic/include/mavlink/v2.0/common/common.hpp:2674,
from /home/l/catkin_ws/src/mavros/libmavconn/include/mavconn/mavlink_dialect.h:26,
from /home/l/catkin_ws/src/mavros/mavros_msgs/include/mavros_msgs/mavlink_convert.h:18,
from /home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:22,
from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_sensor_orientation.cpp:17:
/opt/ros/melodic/include/mavlink/v2.0/common/../standard/../minimal/minimal.hpp:34:12: note: ‘mavlink::minimal::MAV_AUTOPILOT’
enum class MAV_AUTOPILOT : uint8_t
^~~~~~~~~~~~~
In file included from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_sensor_orientation.cpp:17:0:
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:71:40: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(mavlink::common::MAV_TYPE e);
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:68:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::MAV_SENSOR_ORIENTATION)’
std::string to_string(mavlink::common::MAV_SENSOR_ORIENTATION e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:71:40: error: ‘MAV_TYPE’ is not a member of ‘mavlink::common’
std::string to_string(mavlink::common::MAV_TYPE e);
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:71:40: note: suggested alternative: ‘AIS_TYPE’
std::string to_string(mavlink::common::MAV_TYPE e);
^~~~~~~~
AIS_TYPE
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:72:40: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(mavlink::common::MAV_STATE e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:68:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::MAV_SENSOR_ORIENTATION)’
std::string to_string(mavlink::common::MAV_SENSOR_ORIENTATION e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:72:40: error: ‘MAV_STATE’ is not a member of ‘mavlink::common’
std::string to_string(mavlink::common::MAV_STATE e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:72:40: note: suggested alternative: ‘MAV_FRAME’
std::string to_string(mavlink::common::MAV_STATE e);
^~~~~~~~~
MAV_FRAME
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:73:40: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(mavlink::common::MAV_COMPONENT e);
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:68:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::MAV_SENSOR_ORIENTATION)’
std::string to_string(mavlink::common::MAV_SENSOR_ORIENTATION e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:73:40: error: ‘MAV_COMPONENT’ is not a member of ‘mavlink::common’
std::string to_string(mavlink::common::MAV_COMPONENT e);
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:73:40: note: suggested alternative: ‘MAV_MODE’
std::string to_string(mavlink::common::MAV_COMPONENT e);
^~~~~~~~~~~~~
MAV_MODE
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:114:18: error: ‘MAV_TYPE’ in namespace ‘mavlink::common’ does not name a type
mavlink::common::MAV_TYPE mav_type_from_str(const std::string &mav_type);
^~~~~~~~
CMakeFiles/mavros.dir/build.make:62: recipe for target 'CMakeFiles/mavros.dir/src/lib/enum_sensor_orientation.cpp.o' failed
make[2]: *** [CMakeFiles/mavros.dir/src/lib/enum_sensor_orientation.cpp.o] Error 1
make[2]: *** 正在等待未完成的任务....
In file included from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:0:
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:70:40: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(mavlink::common::MAV_AUTOPILOT e);
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:68:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::MAV_SENSOR_ORIENTATION)’
std::string to_string(mavlink::common::MAV_SENSOR_ORIENTATION e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:70:40: error: ‘MAV_AUTOPILOT’ is not a member of ‘mavlink::common’
std::string to_string(mavlink::common::MAV_AUTOPILOT e);
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:70:40: note: suggested alternative:
In file included from /opt/ros/melodic/include/mavlink/v2.0/common/../standard/standard.hpp:42:0,
from /opt/ros/melodic/include/mavlink/v2.0/common/common.hpp:2674,
from /home/l/catkin_ws/src/mavros/libmavconn/include/mavconn/mavlink_dialect.h:26,
from /home/l/catkin_ws/src/mavros/mavros_msgs/include/mavros_msgs/mavlink_convert.h:18,
from /home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:22,
from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:
/opt/ros/melodic/include/mavlink/v2.0/common/../standard/../minimal/minimal.hpp:34:12: note: ‘mavlink::minimal::MAV_AUTOPILOT’
enum class MAV_AUTOPILOT : uint8_t
^~~~~~~~~~~~~
In file included from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:0:
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:71:40: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(mavlink::common::MAV_TYPE e);
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:68:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::MAV_SENSOR_ORIENTATION)’
std::string to_string(mavlink::common::MAV_SENSOR_ORIENTATION e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:71:40: error: ‘MAV_TYPE’ is not a member of ‘mavlink::common’
std::string to_string(mavlink::common::MAV_TYPE e);
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:71:40: note: suggested alternative: ‘AIS_TYPE’
std::string to_string(mavlink::common::MAV_TYPE e);
^~~~~~~~
AIS_TYPE
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:72:40: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(mavlink::common::MAV_STATE e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:68:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::MAV_SENSOR_ORIENTATION)’
std::string to_string(mavlink::common::MAV_SENSOR_ORIENTATION e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:72:40: error: ‘MAV_STATE’ is not a member of ‘mavlink::common’
std::string to_string(mavlink::common::MAV_STATE e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:72:40: note: suggested alternative: ‘MAV_FRAME’
std::string to_string(mavlink::common::MAV_STATE e);
^~~~~~~~~
MAV_FRAME
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:73:40: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(mavlink::common::MAV_COMPONENT e);
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:68:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::MAV_SENSOR_ORIENTATION)’
std::string to_string(mavlink::common::MAV_SENSOR_ORIENTATION e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:73:40: error: ‘MAV_COMPONENT’ is not a member of ‘mavlink::common’
std::string to_string(mavlink::common::MAV_COMPONENT e);
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:73:40: note: suggested alternative: ‘MAV_MODE’
std::string to_string(mavlink::common::MAV_COMPONENT e);
^~~~~~~~~~~~~
MAV_MODE
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:114:18: error: ‘MAV_TYPE’ in namespace ‘mavlink::common’ does not name a type
mavlink::common::MAV_TYPE mav_type_from_str(const std::string &mav_type);
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:24:24: error: ‘mavlink::common::MAV_AUTOPILOT’ has not been declared
using mavlink::common::MAV_AUTOPILOT;
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:25:24: error: ‘mavlink::common::MAV_TYPE’ has not been declared
using mavlink::common::MAV_TYPE;
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:26:24: error: ‘mavlink::common::MAV_STATE’ has not been declared
using mavlink::common::MAV_STATE;
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:27:24: error: ‘mavlink::common::MAV_COMPONENT’ has not been declared
using mavlink::common::MAV_COMPONENT;
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:131:23: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(MAV_AUTOPILOT e)
^~~~~~~~~~~~~
In file included from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:0:
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:80:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::LANDING_TARGET_TYPE)’
std::string to_string(mavlink::common::LANDING_TARGET_TYPE e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:131:23: error: ‘MAV_AUTOPILOT’ was not declared in this scope
std::string to_string(MAV_AUTOPILOT e)
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:131:23: note: suggested alternative:
In file included from /opt/ros/melodic/include/mavlink/v2.0/common/../standard/standard.hpp:42:0,
from /opt/ros/melodic/include/mavlink/v2.0/common/common.hpp:2674,
from /home/l/catkin_ws/src/mavros/libmavconn/include/mavconn/mavlink_dialect.h:26,
from /home/l/catkin_ws/src/mavros/mavros_msgs/include/mavros_msgs/mavlink_convert.h:18,
from /home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:22,
from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:
/opt/ros/melodic/include/mavlink/v2.0/common/../standard/../minimal/minimal.hpp:34:12: note: ‘mavlink::minimal::MAV_AUTOPILOT’
enum class MAV_AUTOPILOT : uint8_t
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:192:23: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(MAV_TYPE e)
^~~~~~~~
In file included from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:0:
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:80:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::LANDING_TARGET_TYPE)’
std::string to_string(mavlink::common::LANDING_TARGET_TYPE e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:192:23: error: ‘MAV_TYPE’ was not declared in this scope
std::string to_string(MAV_TYPE e)
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:192:23: note: suggested alternative:
In file included from /opt/ros/melodic/include/mavlink/v2.0/common/../standard/standard.hpp:42:0,
from /opt/ros/melodic/include/mavlink/v2.0/common/common.hpp:2674,
from /home/l/catkin_ws/src/mavros/libmavconn/include/mavconn/mavlink_dialect.h:26,
from /home/l/catkin_ws/src/mavros/mavros_msgs/include/mavros_msgs/mavlink_convert.h:18,
from /home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:22,
from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:
/opt/ros/melodic/include/mavlink/v2.0/common/../standard/../minimal/minimal.hpp:63:12: note: ‘mavlink::minimal::MAV_TYPE’
enum class MAV_TYPE : uint8_t
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:243:21: error: ‘MAV_TYPE’ was not declared in this scope
std::string to_name(MAV_TYPE e)
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:243:21: note: suggested alternative:
In file included from /opt/ros/melodic/include/mavlink/v2.0/common/../standard/standard.hpp:42:0,
from /opt/ros/melodic/include/mavlink/v2.0/common/common.hpp:2674,
from /home/l/catkin_ws/src/mavros/libmavconn/include/mavconn/mavlink_dialect.h:26,
from /home/l/catkin_ws/src/mavros/mavros_msgs/include/mavros_msgs/mavlink_convert.h:18,
from /home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:22,
from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:
/opt/ros/melodic/include/mavlink/v2.0/common/../standard/../minimal/minimal.hpp:63:12: note: ‘mavlink::minimal::MAV_TYPE’
enum class MAV_TYPE : uint8_t
^~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:244:1: error: expected ‘,’ or ‘;’ before ‘{’ token
{
^
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:280:23: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(MAV_STATE e)
^~~~~~~~~
In file included from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:0:
/home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:80:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::LANDING_TARGET_TYPE)’
std::string to_string(mavlink::common::LANDING_TARGET_TYPE e);
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:280:23: error: ‘MAV_STATE’ was not declared in this scope
std::string to_string(MAV_STATE e)
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:280:23: note: suggested alternative:
In file included from /opt/ros/melodic/include/mavlink/v2.0/common/../standard/standard.hpp:42:0,
from /opt/ros/melodic/include/mavlink/v2.0/common/common.hpp:2674,
from /home/l/catkin_ws/src/mavros/libmavconn/include/mavconn/mavlink_dialect.h:26,
from /home/l/catkin_ws/src/mavros/mavros_msgs/include/mavros_msgs/mavlink_convert.h:18,
from /home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:22,
from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:
/opt/ros/melodic/include/mavlink/v2.0/common/../standard/../minimal/minimal.hpp:146:12: note: ‘mavlink::minimal::MAV_STATE’
enum class MAV_STATE : uint8_t
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:584:23: error: ‘std::__cxx11::string mavros::utils::to_string’ redeclared as different kind of symbol
std::string to_string(MAV_COMPONENT e)
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:431:13: note: previous declaration ‘std::__cxx11::string mavros::utils::to_string(mavlink::common::GPS_FIX_TYPE)’
std::string to_string(GPS_FIX_TYPE e)
^~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:584:23: error: ‘MAV_COMPONENT’ was not declared in this scope
std::string to_string(MAV_COMPONENT e)
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:584:23: note: suggested alternative:
In file included from /opt/ros/melodic/include/mavlink/v2.0/common/../standard/standard.hpp:42:0,
from /opt/ros/melodic/include/mavlink/v2.0/common/common.hpp:2674,
from /home/l/catkin_ws/src/mavros/libmavconn/include/mavconn/mavlink_dialect.h:26,
from /home/l/catkin_ws/src/mavros/mavros_msgs/include/mavros_msgs/mavlink_convert.h:18,
from /home/l/catkin_ws/src/mavros/mavros/include/mavros/utils.h:22,
from /home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:19:
/opt/ros/melodic/include/mavlink/v2.0/common/../standard/../minimal/minimal.hpp:165:12: note: ‘mavlink::minimal::MAV_COMPONENT’
enum class MAV_COMPONENT
^~~~~~~~~~~~~
/home/l/catkin_ws/src/mavros/mavros/src/lib/enum_to_string.cpp:608:1: error: ‘MAV_TYPE’ does not name a type; did you mean ‘LC_CTYPE’?
MAV_TYPE mav_type_from_str(const std::string &mav_type)
^~~~~~~~
LC_CTYPE
CMakeFiles/mavros.dir/build.make:86: recipe for target 'CMakeFiles/mavros.dir/src/lib/enum_to_string.cpp.o' failed
make[2]: *** [CMakeFiles/mavros.dir/src/lib/enum_to_string.cpp.o] Error 1
CMakeFiles/Makefile2:552: recipe for target 'CMakeFiles/mavros.dir/all' failed
make[1]: *** [CMakeFiles/mavros.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

@wangjinhoon
Copy link

try it
mavlink/mavros#1483

maybe solve this issue

@LyMing9
Copy link
Author

LyMing9 commented Feb 23, 2024

Hi @wangjinhoon ,

Thank you so much for resolving my issue on GitHub! It indeed worked for me! I updated the mavros version from 0.33.3 to the latest version 1.17.0, and the project was successfully built. Thanks again for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants