Rablidad
Rablidad

Reputation: 55

C++ gRPC service stub is not being generated

I'm trying to compile my .proto file, but protoc.exe is not generating the service class with its methods in cpp, protoc.exe is only compiling the messages. I'm compiling the .proto file with this command:

protoc -I=".\protos\" --cpp_out=".\protos\" ".\protos\mathtest.proto"

this is my .proto file: here are you can see, the Mathematics service I've defined

and here is the error I get, I can't access the Mathematics class that should have been generated, in my cpp code.Can't find Mathematics service

Is there anything else I'm missing here when compiling my .proto file? thank you!

Upvotes: 0

Views: 734

Answers (1)

Rablidad
Rablidad

Reputation: 55

I found the answer, this is the command that got it working:

protoc -I .\protos\ --cpp_out=".\protos\" --grpc_out=".\protos\" --plugin=protoc-gen-grpc="C:\Program Files (x86)\grpc\bin\grpc_cpp_plugin.exe" .\protos\mathtest.proto

it happens that I was not generating the grpc code, I had to add these two more options:

--grpc_out=".\protos\" --plugin=protoc-gen-grpc="C:\Program Files (x86)\grpc\bin\grpc_cpp_plugin.exe"

Now it works and it generated the grpc stub properly in cpp!

Upvotes: 2

Related Questions