Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取google::protobuf::Descriptor* 问题 #16

Open
dede8385 opened this issue Nov 15, 2017 · 1 comment
Open

获取google::protobuf::Descriptor* 问题 #16

dede8385 opened this issue Nov 15, 2017 · 1 comment

Comments

@dede8385
Copy link

陈老师,你好!
碰到个问题,在使用protobuf时,我看了codec.h里封装的代码,我在测试中碰到如下问题:
比如我有个 AutoReq.proto,它属于package montnets;
调用 const google::protobuf::Descriptor* descriptor =
google::protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName("montnets.AuthReq");
后校验 descriptor 为nullptr, 如果我在调用这个的前面加上 static montnets::AuthReq request; 就能正常。难道一定要在项目中先使用到具体的一个protobuf类之后它才能放入DescriptorPool 池中,这个怎么优化!
谢谢! 附带:我使用的是protobuf 3.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants