Compiler error when trying to migrate to catkin
I'm trying to port a previous project to catkin , which has been made in rosbuild. After rewriting the CMakeLists.txt I encounter the following compiler error:
crazyflie@crazyflie-ThinkPad-T550:~/catkin_ws$ catkin_make
Base path: /home/crazyflie/catkin_ws
Source space: /home/crazyflie/catkin_ws/src
Build space: /home/crazyflie/catkin_ws/build
Devel space: /home/crazyflie/catkin_ws/devel
Install space: /home/crazyflie/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/crazyflie/catkin_ws/build"
####
####
#### Running command: "make -j4 -l4" in "/home/crazyflie/catkin_ws/build"
####
[ 0%] Built target roscpp_generate_messages_nodejs
[ 0%] Built target std_msgs_generate_messages_py
[ 0%] Built target _crazypkg_generate_messages_check_deps_ViconData
[ 0%] Built target _crazypkg_generate_messages_check_deps_ControllerOutputPackage
[ 0%] Built target _crazypkg_generate_messages_check_deps_ControllerParam
[ 0%] Built target _crazypkg_generate_messages_check_deps_MotorCommands
[ 0%] Built target std_msgs_generate_messages_nodejs
[ 0%] Built target _crazypkg_generate_messages_check_deps_PositionSetpoint
[ 0%] Built target _crazypkg_generate_messages_check_deps_SampleTimeParam
[ 0%] Built target std_msgs_generate_messages_lisp
[ 0%] Built target std_msgs_generate_messages_eus
[ 0%] Built target std_msgs_generate_messages_cpp
[ 0%] Built target rosgraph_msgs_generate_messages_eus
[ 0%] Built target roscpp_generate_messages_py
[ 0%] Built target rosgraph_msgs_generate_messages_nodejs
[ 0%] Built target roscpp_generate_messages_cpp
[ 0%] Built target rosgraph_msgs_generate_messages_cpp
[ 0%] Built target roscpp_generate_messages_eus
[ 0%] Built target roscpp_generate_messages_lisp
[ 0%] Built target rosgraph_msgs_generate_messages_py
[ 0%] Built target rosgraph_msgs_generate_messages_lisp
[ 4%] Built target CrazyControllers
[ 6%] Building CXX object crazypkg/CMakeFiles/CrazyControl.dir/src/ControlManager.cpp.o
[ 21%] Built target crazypkg_generate_messages_py
[ 34%] Built target crazypkg_generate_messages_nodejs
[ 47%] Built target crazypkg_generate_messages_lisp
[ 60%] Built target crazypkg_generate_messages_cpp
[ 76%] Built target crazypkg_generate_messages_eus
[ 76%] Built target crazypkg_generate_messages
[ 80%] Built target ViconDataStreamSDK
[ 93%] Built target GUI
In file included from /opt/ros/kinetic/include/ros/serialization.h:37:0,
from /opt/ros/kinetic/include/ros/publisher.h:34,
from /opt/ros/kinetic/include/ros/node_handle.h:32,
from /opt/ros/kinetic/include/ros/ros.h:45,
from /home/crazyflie/catkin_ws/src/crazypkg/include/CrazyFlieInclude.h:5,
from /home/crazyflie/catkin_ws/src/crazypkg/src/ControlManager.cpp:1:
/opt/ros/kinetic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::MD5Sum<M>::value(const M&) [with M = int]’:
/opt/ros/kinetic/include/ros/message_traits.h:255:102: required from ‘const char* ros::message_traits::md5sum(const M&) [with M = int]’
/opt/ros/kinetic/include/ros/publisher.h:112:7: required from ‘void ros::Publisher::publish(const M&) const [with M = int]’
/home/crazyflie/catkin_ws/src/crazypkg/src/ControlManager.cpp:518:69: required from here
/opt/ros/kinetic/include/ros/message_traits.h:126:34: error: request for member ‘__getMD5Sum’ in ‘m’, which is of non-class type ‘const int’
return m.__getMD5Sum().c_str();
^
/opt/ros/kinetic/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::DataType<M>::value(const M&) [with M = int]’:
/opt/ros/kinetic/include/ros/message_traits.h:264:104: required from ‘const char* ros::message_traits::datatype(const M&) [with M = int]’
/opt/ros/kinetic/include/ros/publisher.h:112:7: required from ‘void ros::Publisher::publish(const M&) const [with M = int]’
/home/crazyflie/catkin_ws/src/crazypkg/src/ControlManager.cpp:518:69: required from here
/opt/ros/kinetic/include/ros/message_traits.h:143:36: error: request for member ‘__getDataType’ in ‘m’, which is of non-class type ‘const int’
return m.__getDataType().c_str();
^
crazypkg/CMakeFiles/CrazyControl.dir/build.make:62: recipe for target 'crazypkg/CMakeFiles/CrazyControl.dir/src/ControlManager.cpp.o' failed ...
The problem is actually most likely not with your build scripts, but with how you use certain pieces of ROS infrastructure. Can you show us some code around
ControlManager.cpp:518
?Thanks for your reply!! I edited the original post. It shows the whole
void CControlMgr::callbackViconData(const crazypkg::ViconData& msgViconData)
which is part of ControlManager.cpp The Line 518 is at the end