im doing the ros tutorials, i have created the talker.cpp and listener.cpp but after running catkin_make im getting the below output. please help thank you

asked 2020-05-01 21:03:30 -0500

theneedle1 gravatar image

updated 2020-05-02 06:55:31 -0500

gvdhoorn gravatar image

Straight dump of the CMake output:

####
#### Running command: "cmake /home/leeroy/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/leeroy/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/leeroy/catkin_ws/install -G Unix Makefiles" in "/home/leeroy/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/leeroy/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/leeroy/catkin_ws/devel;/opt/ros/melodic
-- This workspace overlays: /home/leeroy/catkin_ws/devel;/opt/ros/melodic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/leeroy/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.17") 
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.23
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- beginner_tutorials: 1 messages, 1 services
-- Configuring done
-- Generating done
-- Build files have been written to: /home/leeroy/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/leeroy/catkin_ws/build"
####
[  0%] Built target std_msgs_generate_messages_eus
[  0%] Built target std_msgs_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_lisp
[  0%] Built target std_msgs_generate_messages_nodejs
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_Num
[  0%] Built target std_msgs_generate_messages_py
[ 41%] Built target beginner_tutorials_generate_messages_lisp
[ 35%] Built target beginner_tutorials_generate_messages_cpp
[ 41%] Built target beginner_tutorials_generate_messages_eus
[ 52%] Built target beginner_tutorials_generate_messages_nodejs
[ 58%] Building CXX object beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o
[ 64%] Building CXX object beginner_tutorials/CMakeFiles/talker.dir/src/talker.cpp.o
[ 88%] Built target beginner_tutorials_generate_messages_py
[ 88%] Built target beginner_tutorials_generate_messages
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/boost/math/tools/config.hpp:18,
                 from /usr/include/boost/math/special_functions/round.hpp:13,
                 from /opt/ros/melodic/include/ros/time.h:58,
                 from /opt/ros/melodic/include/ros/ros.h:38,
                 from /home/leeroy/catkin_ws/src/beginner_tutorials/src/listener.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3572:15: error: stray ‘\302’ in program
     typename _?inavpPredicate>
               ^
/usr/include/c++/7/bits/stl_algo.h:3573:14: error: stray ‘\357’ in program
     inline bo?l`   is_permutat?on(_FkrwardHteratkr!"__first1, _ForwabdIter!tor1 __la{t1,
              ^
/usr/include/c++/7/bits/stl_algo.h:3573:16: error: stray ‘\16’ in program
     inline bo?l`   is_permutat?on(_FkrwardHteratkr!"__first1, _ForwabdIter!tor1 __la{t1,
                ^
/usr/include/c++/7/bits/stl_algo.h:3573:17: error: stray ‘`’ in program
     inline bo?l`   is_permutat?on(_FkrwardHteratkr!"__first1, _ForwabdIter!tor1 __la{t1,
                 ^
/usr/include/c++/7/bits/stl_algo.h:3573:32: error: stray ‘\351’ in program
     inline bo?l`   is_permutat?on(_FkrwardHteratkr!"__first1, _ForwabdIter!tor1 __la{t1,
                                ^
/usr/include/c++/7/bits/stl_algo.h:3573:53: error: missing terminating " character
     inline bo?l`   is_permutat?on(_FkrwardHteratkr!"__first1, _ForwabdIter!tor1 __la{t1,
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_algo.h:3574:38: error: stray ‘`’ in program
      _ForwardIterator2(__firwt2, _Bin`ryPredicate`__qred(
                                      ^
/usr/include/c++/7/bits/stl_algo.h:3574:50: error ...
(more)
edit retag flag offensive close merge delete

Comments

You better provide the source code.

dxp397@foxmail.com gravatar image dxp397@foxmail.com  ( 2020-05-02 09:46:01 -0500 )edit

TALKER

include "ros/ros.h"

include "std_msgs/String.h"

include <sstream>

int main(int argc, char **argv) {

ros::init(argc, argv, "talker");

ros::NodeHandle n;

ros::Publisher chatter_pub = n.advertise<std_msgs::string>("chatter", 1000);

ros::Rate loop_rate(10);

int count = 0; while (ros::ok()) { std_msgs::String msg;

std::stringstream ss;
ss << "hello world " << count;
msg.data = ss.str();

ROS_INFO("%s", msg.data.c_str());

chatter_pub.publish(msg);

ros::spinOnce();

loop_rate.sleep();
++count;

}

return 0; }

LISTENER

include "ros/ros.h"

include "std_msgs/String.h"

void chatterCallback(const std_msgs::String::ConstPtr& msg) { ROS_INFO("I heard: [%s]", msg->data.c_str()); }

int main(int argc, char **argv) {

ros::init(argc, argv, "listener");

ros::NodeHandle n;

ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);

ros::spin();

return 0; }

theneedle1 gravatar image theneedle1  ( 2020-05-05 10:55:39 -0500 )edit