Unable to link with lprotobuf (C++, Ubuntu)

559 views
Skip to first unread message

A

unread,
Jul 30, 2019, 1:24:22 PM7/30/19
to Protocol Buffers
Hi All,

This may be a silly question but I'm unable to compile my C++ code with protobuf on ubuntu.
I've installed it in /usr/local/ and while running below command

g++ main.cpp -L/usr/local/lib -l lprotobuf

I get this error.

/usr/bin/ld: cannot find -llprotobuf
collect2: error: ld returned 1 exit status

Can someone help me in this regard ?

sachin chadha

unread,
Jul 30, 2019, 1:34:46 PM7/30/19
to A, Protocol Buffers
How about this

g++ main.cpp -L/usr/local/lib -lprotobuf



--
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/23ea5b48-c57f-43f1-9934-88728e46913e%40googlegroups.com.

A

unread,
Jul 30, 2019, 1:38:59 PM7/30/19
to Protocol Buffers
Didn't work :(

g++ main.cpp -L/usr/local/lib -lprotobuf

/usr/bin/ld: /tmp/ccJZGkWr.o: in function `main':
main.cpp:(.text+0xab): undefined reference to `addressBook::AddressBook::AddressBook()'
/usr/bin/ld: main.cpp:(.text+0x15b): undefined reference to `addressBook::AddressBook::~AddressBook()'
/usr/bin/ld: main.cpp:(.text+0x194): undefined reference to `addressBook::AddressBook::~AddressBook()'

collect2: error: ld returned 1 exit status

 g++ main.cpp -L/usr/local/lib -libprotobuf
/usr/bin/ld: cannot find -libprotobuf

collect2: error: ld returned 1 exit status


On Tuesday, 30 July 2019 23:04:46 UTC+5:30, sachin chadha wrote:
How about this

g++ main.cpp -L/usr/local/lib -lprotobuf



On Tue, 30 Jul 2019 at 19:24, A <anurag...@gmail.com> wrote:
Hi All,

This may be a silly question but I'm unable to compile my C++ code with protobuf on ubuntu.
I've installed it in /usr/local/ and while running below command

g++ main.cpp -L/usr/local/lib -l lprotobuf

I get this error.

/usr/bin/ld: cannot find -llprotobuf
collect2: error: ld returned 1 exit status

Can someone help me in this regard ?

--
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 prot...@googlegroups.com.

Adam Cozzette

unread,
Jul 30, 2019, 3:30:52 PM7/30/19
to A, Protocol Buffers
You will also have to include your protobuf generated code from address_book.pb.cc (generated by protoc).

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/7ce59ca5-70eb-423b-8d7b-e84c3baa0244%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages