【解决】File does not reside within any path specified using proto_path

清泛原创
使用protoc编译.proto文件时报错:
../main/test/test.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).
总之就是看不懂的报错信息,大概是.proto文件没找到导致的,但明明就是正确地指定了文件路径。
解决:
加 -I 或 --proto-path ,指定.proto文件的路径即可解决。
# ./protoc --cpp_out=. ../main/test/test.proto
改为
# ./protoc --cpp_out=. ../main/test/test.proto -I../main/test
---End---

protobuf

分享到:
评论加载中,请稍后...
回到顶部