您如何指定目錄 - 以下僅當我將我helloworld.proto的檔案夾放入名為的檔案夾中時才有效protos
protoc --dart_out=. -Iprotos helloworld.proto
protos: warning: directory does not exist.
helloworld.proto: File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
uj5u.com熱心網友回復:
-I在這種情況下,您不需要包含,因為helloworld.proto在當前作業目錄中。
-I(proto path) 用于protoc參考不在當前作業目錄中的目錄。${PWD}/helloworld.proto例如,如果您要使用,我認為您需要使用-I=${PWD}. 即使${PWD}等效于當前作業目錄,也會protoc看到帶有目錄前綴的 proto 并希望將其添加到 proto 路徑中。
通常,當您有非本地的 protobuf 匯入時,您需要添加一個 proto 路徑。然后,添加-I=并列出可以找到這些匯入的目錄。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/388068.html
上一篇:引數型別String?不能分配給引數型別String
下一篇:顫振中的單元測驗?
