protobuf编译出错:File does not reside within any path specified using --proto_path (or -I)

遇到的问题

报错截图

报错:network.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).

说明

上面的意思是network.proto文件没有找到,但是比较坑爹的,这个英文解释很难懂

解决办法

protoc --cpp_out=. network.proto -I../data -I../config -I.

原因

增加了-I或者–proto_path后,protoc不在当前目录寻找proto文件了,所以network.proto文件找不见了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章