I grep for other topics, but they dont help me =(. On my working server, i have no sudo privilegies, so i install PB with
./configure --prefix=/home/username/local
Then i create source files with "person" example and succesfully compile it with protoc.
I have no pkg-info =(. I try to compile it with
g++ -I /home/username/local/include -L /home/username/local/lib -lprotobuf -lpthread main.cpp person.pb.cc
and then have a billion simular errors i.e.
person.pb.cc:(.text+0x4cf): undefined reference to `google::protobuf::internal::kEmptyString'
I think, that it is a problem with linking, but how to solve it?
echo $LD_LIBRARY_PATH /home/username/local/lib
in main.cpp:
#include "person.pb.h"
...
Thanks.
Library linking flags go at the end of the compiler's arguments:
Put the library at the end:
From GCC Link Options:
Also, use
-pthread
instead of-lpthread
as-pthread
may set flags for preprocessor and linker.