【发布时间】:2017-12-12 13:15:16
【问题描述】:
我正在尝试用 C++ 生成 Google Assistant 库。 我已经使用 protoc 编译器编译了 embedded_assistant.proto 文件并获得了 embedded_assistant.grpc.pb.h 和 embedded_assistant.grpc.pb.cc图书馆的文件。 我创建了一个客户端文件 ea_main.cc 并将这些文件包含在其中。
当我尝试使用 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 ?我怎样才能得到这些文件? 有什么问题吗?
【问题讨论】:
标签: compiler-errors g++ protocol-buffers google-assistant-sdk protoc