ros-关于wiki教程学习时,编写简单的服务和客户端(C++)时报错 Invoking “make -j8 -l8“ failed

news/2025/1/12 18:02:48/

解决方法: srv下的 AddTwoInts.srv 文件中的内容

改为:

int64 a
int64 b
---
int64 sum

错误出现的原因:在 wiki教程中,要求:

        请确保你已经按照之前教程中的指示创建了本教程中需要的服务AddTwoInts.srv。

而创建这个文件的命令:

 roscp rospy_tutorials AddTwoInts.srv srv/AddTwoInts.srv

对我是无法生效的,报错:

        cp: 无法创建普通文件'srv/AddTwoInts.srv': 没有那个文件或目录

而我采用的是自己书写一个AddTwoInts.srv,参照的是之前wiki里面关于.srv文件的举例:

int64 A
int64 B
---
int64 Sum

大小写出错了!
 

报错信息如下:

dhw@dhw-Inspiron-5593:~/catkin_ws$ catkin_make
Base path: /home/dhw/catkin_ws
Source space: /home/dhw/catkin_ws/src
Build space: /home/dhw/catkin_ws/build
Devel space: /home/dhw/catkin_ws/devel
Install space: /home/dhw/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/dhw/catkin_ws/build"
####
####
#### Running command: "make -j8 -l8" in "/home/dhw/catkin_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_py
[  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_Num
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts
[  4%] Generating EusLisp code from beginner_tutorials/AddTwoInts.srv
[ 14%] Generating Python code from SRV beginner_tutorials/AddTwoInts
[ 14%] Generating Lisp code from beginner_tutorials/AddTwoInts.srv
[ 19%] Generating C++ code from beginner_tutorials/AddTwoInts.srv
[ 23%] Generating Javascript code from beginner_tutorials/AddTwoInts.srv
[ 28%] Built target beginner_tutorials_generate_messages_nodejs
[ 33%] Built target beginner_tutorials_generate_messages_lisp
[ 42%] Built target beginner_tutorials_generate_messages_eus
[ 47%] Generating Python msg __init__.py for beginner_tutorials
[ 52%] Generating Python srv __init__.py for beginner_tutorials
[ 57%] Built target beginner_tutorials_generate_messages_cpp
[ 57%] Built target beginner_tutorials_gencpp
[ 66%] Built target listener
[ 76%] Built target talker
Scanning dependencies of target add_two_ints_client
Scanning dependencies of target add_two_ints_server
[ 85%] Building CXX object beginner_tutorials/CMakeFiles/add_two_ints_server.dir/src/add_two_ints_server.cpp.o
[ 85%] Building CXX object beginner_tutorials/CMakeFiles/add_two_ints_client.dir/src/add_two_ints_client.cpp.o
[ 90%] Built target beginner_tutorials_generate_messages_py
[ 90%] Built target beginner_tutorials_generate_messages
/home/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_client.cpp: In function ‘int main(int, char**)’:
/home/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_client.cpp:17:15: error: ‘beginner_tutorials::AddTwoInts::Request {aka struct beginner_tutorials::AddTwoIntsRequest_<std::allocator<void> >}’ has no member named ‘a’srv.request.a = atoll(argv[1]);^
/home/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_client.cpp:18:15: error: ‘beginner_tutorials::AddTwoInts::Request {aka struct beginner_tutorials::AddTwoIntsRequest_<std::allocator<void> >}’ has no member named ‘b’srv.request.b = atoll(argv[2]);^
/home/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_server.cpp: In function ‘bool add(beginner_tutorials::AddTwoInts::Request&, beginner_tutorials::AddTwoInts::Response&)’:
/home/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_server.cpp:7:17: error: ‘beginner_tutorials::AddTwoInts::Request {aka struct beginner_tutorials::AddTwoIntsRequest_<std::allocator<void> >}’ has no member named ‘a’res.sum = req.a + req.b;^
/home/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_server.cpp:7:25: error: ‘beginner_tutorials::AddTwoInts::Request {aka struct beginner_tutorials::AddTwoIntsRequest_<std::allocator<void> >}’ has no member named ‘b’res.sum = req.a + req.b;^
In file included from /opt/ros/melodic/include/ros/ros.h:40:0,from /home/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_server.cpp:1:
/home/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_server.cpp:8:51: error: ‘beginner_tutorials::AddTwoInts::Request {aka struct beginner_tutorials::AddTwoIntsRequest_<std::allocator<void> >}’ has no member named ‘a’ROS_INFO("request: x=%ld, y=%ld", (long int)req.a, (long int)req.b);^
/opt/ros/melodic/include/ros/console.h:348:165: note: in definition of macro ‘ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER’sole_define_location__loc.level_, __FILE__, __LINE__, __ROSCONSOLE_FUNCTION__, __VA_ARGS__)^~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:387:7: note: in expansion of macro ‘ROSCONSOLE_PRINT_AT_LOCATION’ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:572:35: note: in expansion of macro ‘ROS_LOG_COND’#define ROS_LOG(level, name, ...) ROS_LOG_COND(true, level, name, __VA_ARGS__)^~~~~~~~~~~~
/opt/ros/melodic/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/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_server.cpp:8:3: note: in expansion of macro ‘ROS_INFO’ROS_INFO("request: x=%ld, y=%ld", (long int)req.a, (long int)req.b);^~~~~~~~
/home/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_server.cpp:8:68: error: ‘beginner_tutorials::AddTwoInts::Request {aka struct beginner_tutorials::AddTwoIntsRequest_<std::allocator<void> >}’ has no member named ‘b’ROS_INFO("request: x=%ld, y=%ld", (long int)req.a, (long int)req.b);^
/opt/ros/melodic/include/ros/console.h:348:165: note: in definition of macro ‘ROSCONSOLE_PRINT_AT_LOCATION_WITH_FILTER’sole_define_location__loc.level_, __FILE__, __LINE__, __ROSCONSOLE_FUNCTION__, __VA_ARGS__)^~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:387:7: note: in expansion of macro ‘ROSCONSOLE_PRINT_AT_LOCATION’ROSCONSOLE_PRINT_AT_LOCATION(__VA_ARGS__); \^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:572:35: note: in expansion of macro ‘ROS_LOG_COND’#define ROS_LOG(level, name, ...) ROS_LOG_COND(true, level, name, __VA_ARGS__)^~~~~~~~~~~~
/opt/ros/melodic/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/dhw/catkin_ws/src/beginner_tutorials/src/add_two_ints_server.cpp:8:3: note: in expansion of macro ‘ROS_INFO’ROS_INFO("request: x=%ld, y=%ld", (long int)req.a, (long int)req.b);^~~~~~~~
beginner_tutorials/CMakeFiles/add_two_ints_client.dir/build.make:62: recipe for target 'beginner_tutorials/CMakeFiles/add_two_ints_client.dir/src/add_two_ints_client.cpp.o' failed
make[2]: *** [beginner_tutorials/CMakeFiles/add_two_ints_client.dir/src/add_two_ints_client.cpp.o] Error 1
CMakeFiles/Makefile2:1459: recipe for target 'beginner_tutorials/CMakeFiles/add_two_ints_client.dir/all' failed
make[1]: *** [beginner_tutorials/CMakeFiles/add_two_ints_client.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
beginner_tutorials/CMakeFiles/add_two_ints_server.dir/build.make:62: recipe for target 'beginner_tutorials/CMakeFiles/add_two_ints_server.dir/src/add_two_ints_server.cpp.o' failed
make[2]: *** [beginner_tutorials/CMakeFiles/add_two_ints_server.dir/src/add_two_ints_server.cpp.o] Error 1
CMakeFiles/Makefile2:1422: recipe for target 'beginner_tutorials/CMakeFiles/add_two_ints_server.dir/all' failed
make[1]: *** [beginner_tutorials/CMakeFiles/add_two_ints_server.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed


http://www.ppmy.cn/news/217121.html

相关文章

Games101计算机图形学笔记L8 Shading 2(Shading,Pipeline and Texture Mapping)

L8 Shading 2(Shading,Pipeline and Texture Mapping) 简化掉了nl点乘&#xff0c;半程向量比起反射向量更好算&#xff0c; 指数代表容忍度&#xff0c;指数越大&#xff0c;容忍度越低&#xff0c;正常用100到200 p越大高光越小 假设环境光的强度相同&#xff0c;环境光与…

一步一步向上爬,坐上美团了L8技术专家

前言 又逢“金九银十”&#xff0c;年轻的毕业生们满怀希望与忐忑&#xff0c;去寻找、竞争一个工作机会。已经在职的开发同学&#xff0c;也想通过社会招聘或者内推的时机争取到更好的待遇、更大的平台。 然而&#xff0c;面试人群众多&#xff0c;技术市场却相对冷淡&#…

C语言基础(L8 -L14)

L8 &#xff1a;注释 简单直接&#xff0c;规范有用 L9 :接续符和转义符 1.接续符 \ &#xff1a;表示一行没有结束&#xff0c;下一行继续 适用范围&#xff1a; 宏代码块定义 #define SWAP(a,b) \ { \int temp a; \a b; \b temp; \ } …

速锐得解码理想汽车L8方向盘转向角度应用随动大灯照明升级

前日&#xff0c;速锐得解码了理想汽车L8车型&#xff0c;由于理想L8是新款车型&#xff0c;架构和理想L9十分相似&#xff0c;与理想ONE这一代有比较大的差异&#xff0c;这恰恰也是我们很好的一次学习机会&#xff0c;也让我们重新认识了理想汽车。 我这里&#xff0c;只挑有…

地平线征程5「卖爆」:理想L8首发,国产大算力芯片开启量产大潮

作者 | 德新编辑 | 王博 一代传奇车型理想ONE功成身退&#xff0c;L系新车L8、L7接棒。 L8和L7&#xff0c;可以理解成理想ONE换代后的五座和六座版&#xff0c;比ONE更大、配置更高、智能化更强&#xff0c;售价区间覆盖33.98 - 39.98万元。 L9上月刚刚实现了月交付破万&…

【BigHereo 35】---L8---C++真题总结

L8---C真题总结(一) 一,【前言】 在三遍学习法中,第一遍一字不落的快速阅读一本教程形成宏观导图, 第二遍是一字一字进行每一章节的学习,形成每一章的思维导图,第三遍是结合真题返回去阅读教程. 在本博文中,我将字做了历年真题的一些错题进行总结, 希望对所有学习着能有帮助. 思…

操作系统(李治军) L8 CPU管理的直观想法

[TOC]操作系统 CPU的 取指执行 给了cpu初地址自动的取值执行 给地址在内存中取出来执行 50:mov ax,[100] 51:mov bx,[101] … … 依次向下顺序执行 管理CPU最直观的方式 设置好PC初值就完事了* PC–程序计算器,用于取指令并自动计数 计算机中有大概一下几个寄存器&#xff1a; …

l系统形式语法_L8R的完整形式是什么?

l系统形式语法 L8R&#xff1a;稍后 (L8R: Later) L8R is an abbreviation of "Later". L8R是“ Later”的缩写 。 It is an expression, which is commonly used in messaging or chatting on social media networking sites like Facebook, Yahoo Messenger, and …