crying in a small corner trying while trying to build C++ protobuf

49 views
Skip to first unread message

Petras Vestartas

unread,
Sep 25, 2025, 12:38:55 PMSep 25
to Protocol Buffers
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
}

Arjun Patel

unread,
Sep 25, 2025, 1:33:44 PMSep 25
to Protocol Buffers
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.

Message has been deleted

Petras Vestartas

unread,
Sep 25, 2025, 2:44:27 PMSep 25
to Protocol Buffers
@Arjun Patel this is the repository with CMakelists for v29, I could not manage to build for v32:
https://github.com/petrasvestartas/protobuf_example

It is for Ubuntu. 
If someone could show how to build v32, I would then try mac and windows.

Please...
Reply all
Reply to author
Forward
0 new messages