When I call protoc
like this
protoc --cpp_out=. path/to/test.proto
the files
path/to/test.pb.cc
andpath/to/test.pb.h
are generated which is what I want. But, since the cc
needs the h
, the h
is included like this
#include "path/to/test.pb.h"
which is not what I want. The background is that my build tool (scons
) calls protoc
from the project's root and not from the directory which includes the source files. I found no obvious option in the manpage or the help text.
So my next idea was to consider this as "correct" and adjust my build system, but: The two files are siblings in the directory tree, so when one includes the other, no path is needed. Even compiling by hand fails.
Can someone help me with that?
protoc is a compiler for protocol buffers definitions files. It can can generate C++, Java and Python source code for the classes defined in PROTO_FILE.
proto files), the code that the proto compiler generates to interface with data, language-specific runtime libraries, and the serialization format for data that is written to a file (or sent across a network connection).
"protobuf" or "protocol buffers" is the name of a serialization format and/or associated tooling. ". proto" is a schema DSL used for describing the messages you plan to use in your application - it is text based.
Oneof Fields For a oneof field, the protobuf compiler generates a single field with an interface type isMessageName_MyField . It also generates a struct for each of the singular fields within the oneof. These all implement this isMessageName_MyField interface.
Doing find-replace on generated files is most likely easier
than reorganization of your build system (use sed
command on Linux/unix).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With