Compiler errors libprotoc编译protoc文件,但不编译其中包含的其他protoc(google grpc assistant annotations.pb.h无文件或目录错误) 我试图在C++中生成谷歌助手库。 我已经使用protoc编译器编译了embedded_assistant.proto文件,并获得了用于库的embedded_assistant.grpc.pb.h和embedded_assistant.grpc.pb.cc文件。 我创建了一个客户端文件ea_main.cc,并将这些文件包含在其中

Compiler errors libprotoc编译protoc文件,但不编译其中包含的其他protoc(google grpc assistant annotations.pb.h无文件或目录错误) 我试图在C++中生成谷歌助手库。 我已经使用protoc编译器编译了embedded_assistant.proto文件,并获得了用于库的embedded_assistant.grpc.pb.h和embedded_assistant.grpc.pb.cc文件。 我创建了一个客户端文件ea_main.cc,并将这些文件包含在其中,compiler-errors,g++,protocol-buffers,google-assistant-sdk,protoc,Compiler Errors,G++,Protocol Buffers,Google Assistant Sdk,Protoc,当我尝试使用g++编译器编译ea_main.cc时,我得到了这个错误 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_assi

当我尝试使用g++编译器编译ea_main.cc时,我得到了这个错误

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";
protoc似乎没有编译或生成这些.proto文件的头文件。当在google/api/中查看时,它们不在那里

这就是为什么g++编译器会为丢失的annotations.pb.h文件提供错误

为什么protoc没有编译embedded_assistant.proto中包含的proto ?如何获取这些文件??
有什么问题吗?

我得到了解决方案,即在编译时包括其他必需的proto,如:-

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