我试图在C++中生成谷歌助理库。我使用protoc编译器编译了embedded_assistant.proto文件,并获得了库中的embedded_assistant.grpc.pb.h和embedded_assistant.grpc.pb.cc文件。我创建了一个客户机文件ea_main.cc,并将这些文件包含在其中。
当我试图使用ea_main.cc编译器编译g++时,我会得到这个错误。
car@ubuntu:~/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文件中,它包含另一个proto文件,如
import "google/api/annotations.proto";
import "google/rpc/status.proto";似乎原型没有为这些.proto文件编译或生成头文件。当在google/api/他们不存在的时候。
这就是为什么g++编译器为缺少的注释.pb.h文件提供错误的原因。
为什么protoc没有编译embedded_assistant.proto中包含的proto ?我如何获得这些文件??有什么问题吗?
发布于 2017-07-09 11:30:09
我得到了解决方案,即在编译时包括其他必需的原型,例如:-
protoc --proto_path=protos --cpp_out=. protos/embedded_assistant.proto protos/google/api/annotations.proto protos/google/api/http.proto protos/google/rpc/status.protohttps://stackoverflow.com/questions/44984335
复制相似问题