eborghi10 / Hexapod-ROS

An Hexapod robot for ROS Kinetic.
15 stars 6 forks source link

got a error when I build the code. #2

Open ShuiYunXi opened 3 years ago

ShuiYunXi commented 3 years ago

Excuse me,I got a error when I used the repositories code constructed a workspace to build .Can you tell why?

The error information is:

In file included from /home/zys/HexapodAlgorithm/Hexapod-ROS/src/crab_imu/src/IMU/DCM.cpp:9:0: /usr/include/stdlib.h:837:12: error: expected unqualified-id before ‘int’ extern int abs (int x) THROW attribute ((const)) __wur; ^ /usr/include/stdlib.h:837:12: error: expected ‘)’ before ‘int’ /usr/include/stdlib.h:837:12: error: expected ‘)’ before ‘int’ In file included from /usr/include/c++/7/cmath:47:0, from /usr/include/c++/7/math.h:36, from /home/zys/HexapodAlgorithm/Hexapod-ROS/src/crab_imu/src/IMU/DCM.cpp:12: /usr/include/c++/7/bits/std_abs.h:52:11: error: ‘::abs’ has not been declared using ::abs; ^~~ crab_imu/CMakeFiles/imu.dir/build.make:86: recipe for target 'crab_imu/CMakeFiles/imu.dir/src/IMU/DCM.cpp.o' failed make[2]: [crab_imu/CMakeFiles/imu.dir/src/IMU/DCM.cpp.o] Error 1 CMakeFiles/Makefile2:1764: recipe for target 'crab_imu/CMakeFiles/imu.dir/all' failed make[1]: [crab_imu/CMakeFiles/imu.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... In file included from /home/zys/HexapodAlgorithm/Hexapod-ROS/src/crab_body_kinematics/src/body_kinematics.cpp:1:0: /home/zys/HexapodAlgorithm/Hexapod-ROS/src/crab_body_kinematics/src/body_kinematics.hpp:7:10: fatal error: crab_msgs/GetLegIKSolver.h: No such file or directory

include <crab_msgs/GetLegIKSolver.h>

      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated. crab_body_kinematics/CMakeFiles/body_kinematics.dir/build.make:62: recipe for target 'crab_body_kinematics/CMakeFiles/body_kinematics.dir/src/body_kinematics.cpp.o' failed make[2]: [crab_body_kinematics/CMakeFiles/body_kinematics.dir/src/body_kinematics.cpp.o] Error 1 CMakeFiles/Makefile2:1707: recipe for target 'crab_body_kinematics/CMakeFiles/body_kinematics.dir/all' failed make[1]: [crab_body_kinematics/CMakeFiles/body_kinematics.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j2 -l2" failed The terminal process "bash '-c', 'catkin_make'" terminated with exit code: 1.

eborghi10 commented 3 years ago

Hey, make sure crab_msgs is compiled before crab_body_kinematics. The latter can't find these messages compiled when it's required.

ShuiYunXi commented 3 years ago

Thanks~

ShuiYunXi commented 3 years ago

Thanks~,Can you tell me how to make sure crab_msgs is compiled before crab_body_kinematics ?

发件人:Emiliano Borghi @.> 发送时间:2021年11月4日(星期四) 18:54 收件人:eborghi10/Hexapod-ROS @.> 抄 送:ShuiYunXi @.>; Author @.> 主 题:Re: [eborghi10/Hexapod-ROS] got a error when I build the code. (Issue #2)

Hey, make sure crab_msgs is compiled before crab_body_kinematics. The latter can't find these messages compiled when it's required. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

eborghi10 commented 3 years ago

Sure,

  1. Add crab_msgs as build_depend and run_depend here.

  2. Move this line after 15 so the package is in the list of catkin REQUIRED COMPONENTS.

  3. Finally, according to this documentation, add ${catkin_EXPORTED_TARGETS} before this line:

add_dependencies(body_kinematics ${catkin_EXPORTED_TARGETS})

If this works for you, will you open a PR, please?

ShuiYunXi commented 3 years ago

Thanks~,I have receive you reply.I will try again later.But I don't know the "PR".Can you explain the "PR"?


发件人:Emiliano Borghi @.> 发送时间:2021年11月11日(星期四) 19:22 收件人:eborghi10/Hexapod-ROS @.> 抄 送:ShuiYunXi @.>; Author @.> 主 题:Re: [eborghi10/Hexapod-ROS] got a error when I build the code. (Issue #2)

Sure, Add crab_msgs as build_depend and run_depend here. Move this line after 15 so the package is in the list of catkin REQUIRED COMPONENTS. Finally, according to this documentation, add ${catkin_EXPORTED_TARGETS} before this line: add_dependencies(body_kinematics ${catkin_EXPORTED_TARGETS})

If this works for you, will you open a PR, please? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

eborghi10 commented 3 years ago

I mean a pull request: https://opensource.com/article/19/7/create-pull-request-github