I am trying to get protobuf to work for Visual C++ Visual Studio 2022 on windows 10, but the generated pb.h and pb.cc files are throwing tons of errors like:
PROTOBUF_NAMESPACE_OPEN this declaration has no storage class or type specifier
Since I just switched from go to c++ I am wondering if I am missing any steps that might be obvious to c++ users.
Reproduction Steps: I followed the instructions found here: https://medium.com/@dev.ashurai/protoc-protobuf-installation-on-windows-linux-mac-d70d5380489d and here under the c++ windows section: https://github.com/protocolbuffers/protobuf/blob/main/src/README.md
Basically using vcpkg to install protobuff. I then build the pb.c and pb.cc from the proto file detailed below using the protoc.exe inside the vcpkg packages folder. I create an empty C++ project and add the protobuff files to it.
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
package helloworld;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}