That was it! I changed the order and it worked!

$(CXX) -o hello_protobuf $(OBJS) $(LDFLAGS)

Thanks a lot.

Date: Tue, 5 Mar 2013 09:03:04 +0000
Subject: Re: [protobuf] Linker error
From: oliver.jow...@gmail.com
To: farhan1...@hotmail.com
CC: protobuf@googlegroups.com

On Tue, Mar 5, 2013 at 2:25 AM, Mohammad Husain <farhan1...@hotmail.com> wrote:





g++ `pkg-config --cflags --libs protobuf` -o hello_protobuf hello_protobuf.o 
user.pb.o


Probably just argument ordering. The library reference (which will come from 
pkg-config --libs) needs to appear after the object files that refer to symbols 
in the library.

In particular the g++ manpage says "It makes a difference where in the command 
you write [the -l option]; the linker searches and processes libraries and 
object files in the order they are specified.  Thus, foo.o -lz bar.o searches 
library z after file foo.o but before bar.o.  If bar.o refers to functions in 
z, those functions may not be loaded."

Oliver




-- 

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

To post to this group, send email to protobuf@googlegroups.com.

Visit this group at http://groups.google.com/group/protobuf?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 
                                          

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to