当前位置:   article > 正文

ROS学习过程中的错误记录2 - 编写简单的消息发布器和订阅器(C++)_invoking "make -j16 -l16" failed

invoking "make -j16 -l16" failed

编译过程中出现如下错误:

beginner_tutorials/CMakeFiles/listener.dir/build.make:62: recipe for target ‘beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o’ failed
make[2]: *** [beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o] Error 1
CMakeFiles/Makefile2:443: recipe for target ‘beginner_tutorials/CMakeFiles/listener.dir/all’ failed
make[1]: *** [beginner_tutorials/CMakeFiles/listener.dir/all] Error 2
Makefile:138: recipe for target ‘all’ failed
make: *** [all] Error 2
Invoking “make -j4 -l4” failed
在这里插入图片描述

jack@jack-Robot:~/my_ws$ catkin_make
Base path: /home/jack/my_ws
Source space: /home/jack/my_ws/src
Build space: /home/jack/my_ws/build
Devel space: /home/jack/my_ws/devel
Install space: /home/jack/my_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/jack/my_ws/build"
####
####
#### Running command: "make -j4 -l4" in "/home/jack/my_ws/build"
####
[  0%] Built target std_msgs_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_eus
[  0%] Built target std_msgs_generate_messages_lisp
[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_nodejs
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_Num
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts
[ 11%] Built target beginner_tutorials_generate_messages_cpp
[ 29%] Built target beginner_tutorials_generate_messages_eus
[ 52%] Built target beginner_tutorials_generate_messages_py
[ 64%] Built target beginner_tutorials_generate_messages_lisp
Scanning dependencies of target listener
[ 76%] Built target beginner_tutorials_generate_messages_nodejs
[ 82%] Building CXX object beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o
[ 94%] Built target talker
[ 94%] Built target beginner_tutorials_generate_messages
/home/jack/my_ws/src/beginner_tutorials/src/listener.cpp:9:3: error: stray ‘\302’ in program
   ROS_INFO("I heard: [%s]", msg­>data.c_str()); 
   ^
/home/jack/my_ws/src/beginner_tutorials/src/listener.cpp:9:3: error: stray ‘\255’ in program
In file included from /opt/ros/kinetic/include/ros/ros.h:40:0,
                 from /home/jack/my_ws/src/beginner_tutorials/src/listener.cpp:1:
/home/jack/my_ws/src/beginner_tutorials/src/listener.cpp: In function ‘void chatterCallback(const ConstPtr&)’:
/home/jack/my_ws/src/beginner_tutorials/src/listener.cpp:9:35: error: ‘data’ was not declared in this scope
   ROS_INFO("I heard: [%s]", msg­>data.c_str()); 
                                   ^
/opt/ros/kinetic/include/ros/console.h:346:165: note: in definition of macro ‘ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER’
     ::ros::console::print(filter, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, __FILE__, __LINE__, __ROSCONSOLE_FUNCTION__, __VA_ARGS__)
                                                                                                                                                                     ^
/opt/ros/kinetic/include/ros/console.h:379:7: note: in expansion of macro ‘ROSCONSOLE_PRINT_AT_LOCATION’
       ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \
       ^
/opt/ros/kinetic/include/ros/console.h:561:35: note: in expansion of macro ‘ROS_LOG_COND’
 #define ROS_LOG(level, name, ...) ROS_LOG_COND(true, level, name, __VA_ARGS__)
                                   ^
/opt/ros/kinetic/include/rosconsole/macros_generated.h:110:23: note: in expansion of macro ‘ROS_LOG’
 #define ROS_INFO(...) ROS_LOG(::ros::console::levels::Info, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)
                       ^
/home/jack/my_ws/src/beginner_tutorials/src/listener.cpp:9:3: note: in expansion of macro ‘ROS_INFO’
   ROS_INFO("I heard: [%s]", msg­>data.c_str()); 
   ^
beginner_tutorials/CMakeFiles/listener.dir/build.make:62: recipe for target 'beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o' failed
make[2]: *** [beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o] Error 1
CMakeFiles/Makefile2:443: recipe for target 'beginner_tutorials/CMakeFiles/listener.dir/all' failed
make[1]: *** [beginner_tutorials/CMakeFiles/listener.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
  • 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
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60

经过检查,发现程序里[->]中少了[-].

在这里插入图片描述

修改以后继续编译,发现仍然报错,但是错误信息少了很多.

在这里插入图片描述

jack@jack-Robot:~/my_ws$ catkin_make
Base path: /home/jack/my_ws
Source space: /home/jack/my_ws/src
Build space: /home/jack/my_ws/build
Devel space: /home/jack/my_ws/devel
Install space: /home/jack/my_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/jack/my_ws/build"
####
####
#### Running command: "make -j4 -l4" in "/home/jack/my_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_py
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_Num
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts
[  0%] Built target std_msgs_generate_messages_nodejs
[ 11%] Built target beginner_tutorials_generate_messages_cpp
[ 35%] Built target beginner_tutorials_generate_messages_py
[ 58%] Built target beginner_tutorials_generate_messages_lisp
[ 64%] Built target beginner_tutorials_generate_messages_eus
Scanning dependencies of target listener
[ 76%] Built target beginner_tutorials_generate_messages_nodejs
[ 88%] Built target talker
[ 94%] Building CXX object beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o
[ 94%] Built target beginner_tutorials_generate_messages
/home/jack/my_ws/src/beginner_tutorials/src/listener.cpp:9:3: error: stray ‘\302’ in program
   ROS_INFO("I heard: [%s]", msg­->data.c_str()); 
   ^
/home/jack/my_ws/src/beginner_tutorials/src/listener.cpp:9:3: error: stray ‘\255’ in program
beginner_tutorials/CMakeFiles/listener.dir/build.make:62: recipe for target 'beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o' failed
make[2]: *** [beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o] Error 1
CMakeFiles/Makefile2:443: recipe for target 'beginner_tutorials/CMakeFiles/listener.dir/all' failed
make[1]: *** [beginner_tutorials/CMakeFiles/listener.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
  • 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
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39

最后从官方提供的代码中复制了报错的语句:

ROS_INFO("I heard: [%s]", msg->data.c_str());
  • 1

再次编译,发现编译通过.

在这里插入图片描述

再换成自己的代码进行编译,发现仍然不能编译成功.

  • 百 思 不 得 其 解 , 推 测 原 因 可 能 在 于 编 码 问 题 . 百思不得其解,推测原因可能在于编码问题. ,.
    在这里插入图片描述

至 此 , 一 把 辛 酸 泪 的 错 误 暂 时 告 一 段 落 . . . . . . 至此,一把辛酸泪的错误暂时告一段落...... ,......

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

闽ICP备14008679号