undefined reference to `google::protobuf ...`

289 views
Skip to first unread message

z mk

unread,
Jan 21, 2022, 12:06:55 AM1/21/22
to Protocol Buffers
/tmp/cc4oF0nm.o: In function `tutorial::Person_PhoneType_descriptor()':
addressbook.pb.cc:(.text+0x1e): undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)'

There are many similar errors when I run 
”g++ addressbook.pb.cc add_person.cc -o main `pkg-config --cflags --libs protobuf` 
”in ~/protobuf/examples

Here's how I installed 3.19.3: 
./configure --prefix=/usr
make -j8 make check -j8 #7 pass sudo make install 
sudo ldconfig

I have tried 2.x.x and 3.19.3, both are wrong, include ROS melodic. 
And I tried to delete all file like "/include/proto*" and "libproto*" except file of Anaconda and python. And then I tried to install again, problem was as usual :(. 
I have no idea how to fix this. 

Deanna Garcia

unread,
Jan 24, 2022, 7:18:17 PM1/24/22
to Protocol Buffers
If you are just trying to run the examples you shouldn't use the g++ command. Instead, follow the steps in the README, specifically under "Build the example using make".'

The g++ command you are trying to run is only to compile dependent packages (which isn't needed to run the examples). 

Reply all
Reply to author
Forward
0 new messages