首页 > 编程语言 > 详细

解决proto文件转换时提示“Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it. ”

时间:2020-05-01 17:53:22      阅读:105      评论:0      收藏:0      [点我收藏+]

前言:

想将.proto文件转换成.pb文件时一直报错,一开始以为是文件编码格式的问题,后来将文件改成windows下的utf-8格式后,又出现了新的报错(见下图)。百度了很久,才找到解决方法。

技术分享图片

 

 

 

这个报错的意思是:“building_produce”在“WNet”整个放pb文件的文件夹中必须是唯一的,而不仅仅是在“open_case_type”这个menu中唯一。

所以说这个menu speed_up_target_type中的building_produce在其他地方(可能是这个proto文件中、也可能是整个文件夹中)有个同名的。

 

技术分享图片

 

 

果然搜索后发现有个message building_produce

 

技术分享图片

 

 

解决方法:

如果提示已经存在了,就将enum里的building_produce改个唯一的名字咯

谷歌官方文档里还有一个解决方法:

在这个enum中添加option allow_alias = true;

技术分享图片

 

 

具体的可以查看https://developers.google.com/protocol-buffers/docs/proto3

 

解决proto文件转换时提示“Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it. ”

原文:https://www.cnblogs.com/lucio1128/p/12814032.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!