error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’

Posted python_boy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’相关的知识,希望对你有一定的参考价值。

最近安装caffe,突然报这个错:

.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::set_mean_file(const char*)’:
.build_release/src/caffe/proto/caffe.pb.h:17957:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
   if (mean_file_ == &::google::protobuf::internal::kEmptyString) {
                      ^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::set_mean_file(const char*, size_t)’:
.build_release/src/caffe/proto/caffe.pb.h:17964:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
   if (mean_file_ == &::google::protobuf::internal::kEmptyString) {
                      ^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘std::string* caffe::ImageDataParameter::mutable_mean_file()’:
.build_release/src/caffe/proto/caffe.pb.h:17971:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
   if (mean_file_ == &::google::protobuf::internal::kEmptyString) {
                      ^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘std::string* caffe::ImageDataParameter::release_mean_file()’:
.build_release/src/caffe/proto/caffe.pb.h:17978:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
   if (mean_file_ == &::google::protobuf::internal::kEmptyString) {
                      ^
.build_release/src/caffe/proto/caffe.pb.h:17982:47: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
     mean_file_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
                                               ^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::set_allocated_mean_file(std::string*)’:
.build_release/src/caffe/proto/caffe.pb.h:17987:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
   if (mean_file_ != &::google::protobuf::internal::kEmptyString) {
                      ^
.build_release/src/caffe/proto/caffe.pb.h:17995:47: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
     mean_file_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
                                               ^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::clear_root_folder()’:
.build_release/src/caffe/proto/caffe.pb.h:18054:24: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
   if (root_folder_ != &::google::protobuf::internal::kEmptyString) {
                        ^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::set_root_folder(const string&)’:
.build_release/src/caffe/proto/caffe.pb.h:18064:24: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
发现又是protoc的版本不对。

查了下:

[email protected]:/home/zenggq/mainspace/mscnn$ which protoc
/usr/bin/protoc
[email protected]:/home/zenggq/mainspace/mscnn$

 

[email protected]:~/zenggq/caffe-bak$ pip show protobuf
Name: protobuf
Version: 3.3.0
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: [email protected]
Author-email: [email protected]
License: 3-Clause BSD License
Location: /home/sensetime/anaconda2/lib/python2.7/site-packages
Requires: six, setuptools
[email protected]:~/zenggq/caffe-bak$

protoc --version

发现是2.5.0

索性把anaconda2下的protoc文件覆盖/usr/bin/protoc。

搞定。

以上是关于error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’的主要内容,如果未能解决你的问题,请参考以下文章

configure: error: gperf is needed

(error) MISCONF Redis is configured to save RDB snapshots, but is currently

mysql - ERROR 1114 (HY000): The table is full

errors.Is in Go 1.13

When “ERROR CAN NOT MAP ERROR CODE : 21” is displayed

(error) DENIED Redis is running in protected mode because protected mode is enabled