protobuf

Protocol buffer3 and json

匿名 (未验证) 提交于 2019-12-03 08:50:26
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Protocol buffer v3 claims, that library is json friendly ( https://developers.google.com/protocol-buffers/docs/proto3#json ), but I cannot find how to achieve get that mapping. Should I add some plugin, or some option into protoc, or call something special instead SerializeTo/ParseFrom? Is it someone who use that feature? 回答1: I'm using Protobuf 3.3.0, which does have a built-in JSON serializer and parser. You can use 2 functions from google/protobuf/util/json_util.h called MessageToJsonString() and JsonStringToMessage() to make your C++

package com.google.protobuf does not exist on OS X Maverick

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am on OS X Mavericks and starting learning about protobuf, i download the example from https://code.google.com/p/protobuf/downloads/list I am successfully able to create the .java file from the proto but while compiling the existing java code using make java, i am getting following error com/example/tutorial/AddressBookProtos.java:91: package com.google.protobuf does not exist com.google.protobuf.GeneratedMessage ^ com/example/tutorial/AddressBookProtos.java:12: package com.google.protobuf does not exist extends com.google.protobuf

How to make CMake find google protobuf on windows?

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Google Protobuf with CMake. On Linux the Protobuf library is found by: find_package( Protobuf REQUIRED ) CMake knows where to look for the library. How though do I get this to work in Windows? Is there an environment variable I should create, such as PROTOBUF_LIB ? I have looked in FindProtobuf.cmake but cannot work out what is required. 回答1: I also struggled with this. To be more clear. On Windows (7, similar on older windows): Start --> Control Panel --> System --> Advanced System Settings --> Environment Variables Then either

ImportError: No module named google.protobuf

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am following this guide ( https://developers.google.com/protocol-buffers/docs/pythontutorial ) and using the exact sample of addressbook.proto. Post the content of compiler generated addressbook_pb2.py file as well. When I run the following simple program, there is error saying, cannot find google.protobuf, any ideas how to resolve this issue? Thanks. BTW, using Python 2.7 on Mac OSX. from addressbook_pb2 import Person p = Person() p.email = "abc" print p.email Here is the automated generated file addressbook_pb2.py, # Generated by the

Maven & Protobuf compile error: Cannot find symbol in package com.google.protobuf

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new to Linux and Protobuf.. I need help. I'm trying to "mvn package" a project that contains many ".proto" files, and a pom.xml file of course... I'm working on Ubuntu ======================================= ERROR When I run "mvn package", I receive this error: after ... Compiling 11 source files to .../target/classes ... I get a bunch of these errors: [ERROR] .../target/generated-sources/...java:[16457,30] cannot find symbol [ERROR] symbol : class Parser [ERROR] location: package com.google.protobuf [ERROR] [ERROR] .../target/generated

Build protobuf on Windows with MinGW

匿名 (未验证) 提交于 2019-12-03 07:47:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been following the steps in Peter's answer to How to build Google's protobuf in Windows using MinGW? but make does not complete and errors out. I am on Win64 and have MinGW with installed the mingw-developer-toolkit , mingw32-base , mingw-gcc-g++ , msys-base and additionally mingw32-phtreads-w32 . Under MinGW/msys/1.0 I create the folder /home/<username> and paste the protobuf-3.1.0 source downloaded from github . I open an MSYS shell, cd into the protobuf dir and run ./autoconfig : the log is here . Now, the first thing I don't like

比较跨语言通讯框架:Apache Thrift和Google Protobuf

倾然丶 夕夏残阳落幕 提交于 2019-12-03 06:06:56
前两天想在微博上发表一个观点:在现在的技术体系中,能用于描述通讯协议的方式很多,xml,json,protobuf,thrift,如果在有如此众多选择的基础上,在设计系统时,还自造协议,自己设计协议类型和解析方式,那么我只能说,您真的落后了,不是技术上,而是思想上。对于xml,和json我们不做过多描述了,参考相关文档就可以了。特别是json,如今在 web系统,页游系统的前后台通讯中,应用非常广泛。 本文将重点介绍两种目前在大型系统中,应用比较普遍的两种通讯框架,thrift和Protobuf ,为什么叫通讯框架,而不叫通讯协议?因为这两种技术,如果仅仅当作协议解析用,对于其强大的功能,就大打了折扣。 对于 两种利器而言,首推的应该是thrift ,因为其不仅有对于协议封装和解析的处理,而且有完备的通讯框架的实现,完全封装了底层通讯 ,对于使用者,只要在框架的客户端和服务器接口回调中,处理逻辑就可以了 。对于其确切的描述,我们还是引用官方的说法吧,这样更准确些,以免由于我自己的想法,影响了大家的理解。 Thrift是一个跨语言的服务部署框架,最初由Facebook于2007年开发,2008年进入Apache开源项目。Thrift通过一个中间语言(IDL, 接口定义语言)来定义RPC的接口和数据类型,然后通过一个编译器生成不同语言的代码(目前支持C++,Java, Python,

Error in python after 'import tensorflow': TypeError: __init__() got an unexpected keyword argument 'syntax'

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I installed TensorFlow on my Ubuntu 15.10 machine as instructed for CPU only: $ pip install https :// storage . googleapis . com / tensorflow / linux / cpu / tensorflow - 0.5 . 0 - cp27 - none - linux_x86_64 . whl Then when I run the Python REPL and import tensorflow, I get: $ python Python 2.7 . 10 ( default , Oct 14 2015 , 16 : 09 : 02 ) [ GCC 5.2 . 1 20151010 ] on linux2 Type "help" , "copyright" , "credits" or "license" for more information . >>> import tensorflow as tf Traceback ( most recent call last ): File " " , line 1 ,

weird ios libprotobuf.dylib cause crash

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i have my own protobuf compiled in the project (in the main target, not a lib), but I found a crash which is caused by protobuf code in libprotobuf.dylib ( which in my guess is a newly included lib in new version of device -- mine is ipad air). * thread #1: tid = 0x6598, 0x0027e96e TutorChat`void google::protobuf::internal::RepeatedPtrFieldBase::Destroy<google::protobuf::RepeatedPtrField<google::protobuf::UninterpretedOption>::TypeHandler>(this=0x1567158c) + 66 at repeated_field.h:814, queue = 'com.apple.main-thread, stop reason = breakpoint

Undefined reference to google::protobuf::internal::empty_string_[abi:cxx11]

匿名 (未验证) 提交于 2019-12-03 03:02:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to build simple test application with Protocol Buffers 2.6.1 and GNU GCC 5.1.0 (on Ubuntu 14.10) and I get following errors: /home/ragnar/cpp-tools/gcc-linux/bin/g++ -c "/home/ragnar/cpp-projects/gprotobuf_test/main.cpp" -g -O0 -Wall -o ./Debug/main.cpp.o -I. -I/home/ragnar/cpp-tools/libs/linux64/protobuf/include -I. /home/ragnar/cpp-tools/gcc-linux/bin/g++ -c "/home/ragnar/cpp-projects/gprotobuf_test/messages.pb.cc" -g -O0 -Wall -o ./Debug/messages.pb.cc.o -I. -I/home/ragnar/cpp-tools/libs/linux64/protobuf/include -I. /home