Home > other >  Google in the ROS: : protobuf undefined reference CPP
Google in the ROS: : protobuf undefined reference CPP

Time:09-23


I tried to use Protocol Buffers in ROS Indigo, look in the link CPP source code problems, at compile time, it raises the following error:
Linking CXX the executable/home/ravi ros_ws/devel/lib/protobuf_ros_tutorial add_person
CMakeFiles/add_person. Dir/SRC/add_person. Cc. O: function In ` PromptForAddress (tutorial: : the Person *) ':
Add_person. Cc: (. The text + 0 x6a) : undefined reference to ` Google: : protobuf: : internal: : fixed_address_empty_string '
Add_person. Cc: (. The text + 0 x1a5) : undefined reference to ` Google: : protobuf: : internal: : ArenaImpl: : AllocateAlignedAndAddCleanup (unsigned long, void (*) (void *))
'Add_person. Cc: (. The text + 0 x1cc) : undefined reference to ` Google: : protobuf: : internal: : fixed_address_empty_string '
Add_person. Cc: (. The text + 0 x322) : undefined reference to ` Google: : protobuf: : internal: : fixed_address_empty_string '
Add_person. Cc: (. The text + 0 x454) : undefined reference to ` Google: : protobuf: : util: : TimeUtil: : SecondsToTimestamp (long) '
Add_person. Cc: (. The text + 0 x496) : undefined reference to ` Google: : protobuf: : Timestamp: : CopyFrom (Google: : protobuf: : Timestamp const&) '
Add_person. Cc: (. The text + 0 x49e) : undefined reference to ` Google: : protobuf: : Timestamp: : ~ Timestamp ()
'Add_person. Cc: (. The text + 0 x52c) : undefined reference to ` Google: : protobuf: : internal: : fixed_address_empty_string '

Below is the CMakeLists. TXT
Cmake_minimum_required (VERSION 2.8.3)
Project (protobuf_ros_tutorial)

Set (CMAKE_CXX_FLAGS "- STD=c + + 11 ${CMAKE_CXX_FLAGS}")

Find_package (catkin REQUIRED COMPONENTS
Roscpp
)

Find_package (Protobuf REQUIRED)

Catkin_package (
)

Include_directories (
Include
The ${catkin_INCLUDE_DIRS}
The ${PROTOBUF_INCLUDE_DIRS}
)

Add_library (addressbook_protobuf include/addressbook. Pb. Cc)

Add_executable (add_person SRC/add_person. Cc)

Target_link_libraries (
Add_person
The ${catkin_LIBRARIES}
Addressbook_protobuf
The ${PROTOBUF_LIBRARIES}
)

Package. XML is the default content is as follows:
<? The XML version="1.0"?>
Protobuf_ros_tutorial & lt;/name>
0.0.0 & lt;/version>
The protobuf_ros_tutorial package


TODO





Below is the file structure of ROS package:
[email protected] : ~/ros_ws/SRC/protobuf_ros_tutorial $ls -r
. :
The SRC CMakeLists. TXT include package. The XML

./include:
Addressbook. Pb. Cc addressbook. Pb. H addressbook. Proto

The./SRC:
Add_person. Cc

I doubt CMakeLists. TXT file, what did I miss?






CodePudding user response:


Protobuf version does not match, I installed the Protobuf 3 from source, however, ROS Indigo used internally Protobuf 2.
As a solution, I deleted the Protobuf 3, and then install it in my local projects,

CodePudding user response:

Can also be CMakelists. TXT in the mandatory protobuf3 specified path
  • Related