1

我想在C++中生成Google智能助理庫。 我一直在使用protoc編譯器編譯的embedded_assistant.proto文件,並獲得embedded_assistant.grpc.pb.hembedded_assistant.grpc.pb.cc文件庫。 我創建了一個客戶文件ea_main.cc並在其中包含了這些文件。libprotoc編譯protoc文件但不包含其他protoc(谷歌grpc助手annotations.pb.h沒有文件或目錄錯誤)

當我嘗試使用g ++編譯器編譯ea_main.cc我得到這個錯誤。

[email protected]:~/grpc/examples/cpp/embedded_assistant$ g++ -I./ ea_main.cc -o OUT_CPP_TEST -std=c++11 
In file included from embedded_assistant.grpc.pb.h:22:0,   
       from ea_main.cc:9: 
embedded_assistant.pb.h:33:39: fatal error: google/api/annotations.pb.h: No such file or directory 
compilation terminated. 

embedded_assistant.proto文件沒有包含在它的另一個原型文件作爲

import "google/api/annotations.proto"; 
import "google/rpc/status.proto"; 

看來,protoc didnt編譯或生成這些.proto文件頭。當在谷歌/ api/看,他們不存在。

這就是爲什麼g ++編譯器爲缺少的annotations.pb.h文件提供錯誤。

爲什麼protoc沒有編譯包含在中的proto embedded_assistant.proto ?我怎樣才能得到這些文件? 有什麼問題嗎?

回答

0

我得到了解決,即包括其他所需的PROTOS在編譯時,如: -

protoc --proto_path=protos --cpp_out=. protos/embedded_assistant.proto protos/google/api/annotations.proto protos/google/api/http.proto protos/google/rpc/status.proto 
相關問題