Where need I to set the path
to the protoc
to get import standards Protocol Buffers (protobuf), like empty.proto
and timestamp.proto
in Windows and Dart?
When the protoc
is ran:
protoc --dart_out=grpc:lib/src/protos/generated -Iprotos protos/organization.proto --plugin=protoc-gen-dart=D:\Users\Samuel\AppData\Roaming\Pub\Cache\bin\protoc-gen-dart.bat
The following error is presented:
google/protobuf/empty.proto: File not found. organization.proto: Import "google/protobuf/empty.proto" was not found or had errors. organization.proto:14:27: "google.protobuf.Empty" is not defined.
In IntelliJ Settings
on Protobuf Support
plugin the path
is define where standard protos (*.proto) are:
Additionally this path
is define in IntelliJ on Project Structure
\ Global Libraries
:
The code organization.proto
that import google/protobuf/empty.proto
to use Empty
class :
syntax = "proto3";
package auge.protobuf;
import "google/protobuf/empty.proto";
service OrganizationService {
rpc GetOrganizations (google.protobuf.Empty) returns (OrganizationsResponse) {}
}
IntelliJ analyzer recognizes the import "google/protobuf/empty.proto"
and Empty
class on IDEA, but protoc
can not find.
The environment is:
Say you have /some/path/to/google/protobuf/empty.proto
, you need to pass --proto_path=/some/path/to/
so protoc can locate it.
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