I went through the same pain. I would suggest that you use vcpkg which
helps with cross-platform dependencies. I've found this to be the simplest.
If this doesn't help, then I can help if you create a simple hello world
cmake project in github and share it. Then I can add scripts and such to
help you.
One note: you should try using cmake commands to generate the source and
header files instead of using the protoc cli tool. This will ensure that
the runtime protobuf version that your C++ project uses matches the version
that protoc used to generate sources and headers from your .proto files.
On Thursday, September 25, 2025 at 9:38:55 AM UTC-7 Petras Vestartas wrote:
> Hi,
>
> For a good week or two I am trying to use protobuf in c++ without luck.
>
> I understand the prorcess of generate pb.c and pb.h files from headers.
> But for de/serializing the binary files you actually need static libraries.
>
> System wide installation on ubuntu, mac-universal and windows are
> "sometimes" available or outdated which lead to build it C++ from source
> which is impossible to me to understand.
>
> What should I do to use protobuf in c++?
> Documentation about installation is really not clear.
>
> I am the most basic user trying to de/serialize as simple as that:
>
> syntax = "proto3";
>
> package session_proto;
>
> // Color message - matching C++ Color class field order
> message ColorProto {
> string name = 1; // std::string name
> string guid = 2; // std::string guid
> uint32 r = 3; // unsigned int r
> uint32 g = 4; // unsigned int g
> uint32 b = 5; // unsigned int b
> uint32 a = 6; // unsigned int a
> }
>
>
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/protobuf/19be937f-e6ef-4a31-a7bb-28a0acd74cb9n%40googlegroups.com.