使用Ubuntu16.04和cmake,我试图从protobuf文件创建一个共享库。cmakes protobuf_generate_cpp正在生成proto_srcs和proto_hdrs。
我的系统中没有任何google/protobuf/*.proto文件,所以我下载了3.6.1并将其移动到/usr/local/include中。我知道我使用的是proto2,protoc是版本2,3.6.1中的一些*.proto文件是proto3,但是下面的文件(我使用的是syntax=“proto2”),所以我认为应该可以。
但是,我遇到了以下错误。
$ protoc --version
libprotoc 2.6.1
[ 2%] Running C++ protocol buffer compiler on models.proto
google/protobuf/descriptor.proto:439:3: Expected "required", "optional", or "repeated".
google/protobuf/descriptor.proto:439:12: Expected field name.
google/protobuf/descriptor.proto:497:3: Expected "required", "optional", or "repeated".
google/protobuf/descriptor.proto:497:12: Expected field name.
google/protobuf/descriptor.proto:498:3: Expected "required", "optional", or "repeated".
google/protobuf/descriptor.proto:498:12: Expected field name.
google/protobuf/descriptor.proto:597:3: Expected "required", "optional", or "repeated".
google/protobuf/descriptor.proto:597:12: Expected field name.
google/protobuf/descriptor.proto:620:3: Expected "required", "optional", or "repeated".
google/protobuf/descriptor.proto:620:12: Expected field name.
edk/edk_extensions.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.
edk/edk_extensions.proto:15:8: ".google.protobuf.FieldOptions" is not defined.
edk/edk_extensions.proto:20:8: ".google.protobuf.MessageOptions" is not defined.
models.proto: Import "edk/edk_extensions.proto" was not found or had errors.
有人有想法吗?