Robotics StackExchange | Archived questions

model plugin make error

Hi i'm using gazebo 9, ubuntu 18.04 and ros-melodic.

I have a custom quadruped robot model, and a custom model plug-in that I made for use here. Actually these are working fine in other computers, but not mine.

When I try to catkin_make, an error occured described below.

[ 98%] Building CXX object aidinvi/CMakeFiles/sub_aidinvi.dir/src/sub_aidinvi.cpp.o In file included from /usr/include/gazebo-9/gazebo/common/common.hh:36:0,
                 from /usr/include/gazebo-9/gazebo/gazebo_core.hh:19,
                 from /usr/include/gazebo-9/gazebo/gazebo.hh:20,
                 from /home/onesoulkang/catkin_ws/src/aidinvi/src/sub_aidinvi.cpp:2: /usr/include/gazebo-9/gazebo/common/Plugin.hh:420:10: error: expected unqualified-id before string constant
   extern "C" GZ_PLUGIN_VISIBLE gazebo::ModelPlugin *RegisterPlugin(); \
          ^ 
/usr/include/gazebo-9/gazebo/common/Plugin.hh:420:10: note: in definition of macro GZ_REGISTER_MODEL_PLUGIN’
   extern "C" GZ_PLUGIN_VISIBLE gazebo::ModelPlugin *RegisterPlugin(); \
          ^~~ 
aidinvi/CMakeFiles/sub_aidinvi.dir/build.make:62: recipe for target 'aidinvi/CMakeFiles/sub_aidinvi.dir/src/sub_aidinvi.cpp.o' failed 
make[2]: *** [aidinvi/CMakeFiles/sub_aidinvi.dir/src/sub_aidinvi.cpp.o] Error 1 CMakeFiles/Makefile2:3604: recipe for target 'aidinvi/CMakeFiles/sub_aidinvi.dir/all' failed 
make[1]: *** [aidinvi/CMakeFiles/sub_aidinvi.dir/all] Error 2 
Makefile:140: recipe for target 'all' failed 
make: *** [all] Error 2 Invoking "make -j4 -l4" failed

Does anyone have any suggestions for handling this problem?

Asked by kanghs0822 on 2020-02-04 11:00:29 UTC

Comments

Answers

While I don't have your code to see, this is most likely due to forgetting to put a semi-colon at the end of your class definition.

You defined your class like this:

namespace gazebo
 {
    class SimplePlugin: public ModelPlugin
      {
      }
 }

Instead of:

namespace gazebo
 {
    class SimplePlugin: public ModelPlugin
      {
      };
 }

Asked by zokowc on 2020-03-20 14:47:58 UTC

Comments

Go to catkin_ws, delete the build folder and rebuild the workspace using catkin_make.

Asked by malikibnueasa on 2023-02-28 10:46:01 UTC

Comments