以加载静态库的方式加载protobuf库时出现如下问题:
[libprotobuf ERROR google/protobuf/descriptor_database.cc:57] File already exists in database: google/protobuf/descriptor.proto
[libprotobuf FATAL google/protobuf/descriptor.cc:1314] CHECK failed: generated_database_->Add(encoded_file_descriptor, size):
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): CHECK failed: generated_database_->Add(encoded_file_descriptor, size):
然后在网上找了如下解决方法:
按照如上方法弄了之后还是不行。因为我本来就是以静态库的方式加载的。后面换成以加载动态库的方式成功了。
具体分析原因是我依赖一个三方库也同时依赖protobuf。这个第三方库是以动态库的方式加载的protobuf库。所以我不能再以加载静态库的方式加载。