undefined reference errors

198 views
Skip to first unread message

Seongjoon Kang

unread,
Jun 1, 2023, 12:38:09 PM6/1/23
to Protocol Buffers
Hi
I tried to compile a simple code as example of protobuf.
But I used to have the following error messages.
Codes are attached. Could you help me correct these bugs ?
Thanks

/usr/bin/ld: /tmp/ccdiZiDW.o: in function `main':
ex1.cc:(.text+0x142): undefined reference to `tutorial::SearchRequest::~SearchRequest()'
/usr/bin/ld: ex1.cc:(.text+0x16b): undefined reference to `tutorial::SearchRequest::~SearchRequest()'
/usr/bin/ld: /tmp/ccdiZiDW.o: in function `google::protobuf::internal::ArenaStringPtr::Set(char const*, google::protobuf::Arena*)':
ex1.cc:(.text._ZN6google8protobuf8internal14ArenaStringPtr3SetEPKcPNS0_5ArenaE[_ZN6google8protobuf8internal14ArenaStringPtr3SetEPKcPNS0_5ArenaE]+0x4e): undefined reference to `google::protobuf::internal::ArenaStringPtr::Set(absl::lts_20230125::string_view, google::protobuf::Arena*)'
/usr/bin/ld: /tmp/ccdiZiDW.o: in function `tutorial::SearchRequest::SearchRequest()':
ex1.cc:(.text._ZN8tutorial13SearchRequestC2Ev[_ZN8tutorial13SearchRequestC5Ev]+0x1d): undefined reference to `tutorial::SearchRequest::SearchRequest(google::protobuf::Arena*)'
collect2: error: ld returned 1 exit status
 
ex1.cc
proto_ex1.proto
proto_ex1.pb.cc
proto_ex1.pb.h

Dirk Jagdmann

unread,
Jun 2, 2023, 6:14:15 PM6/2/23
to Seongjoon Kang, Protocol Buffers
you should show us your linker command line.
> --
> You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/79041063-f686-4819-a52e-ca211557eef0n%40googlegroups.com.



--
---> Dirk Jagdmann
----> http://cubic.org/~doj
-----> http://llg.cubic.org
Reply all
Reply to author
Forward
0 new messages