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 
相关问题