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文件找不見了

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