Linux下利用protoc命令生成protobuf的头文件和源文件,根据mesType.proto文件

protobuf的message文件为 msgType.proto 生成c++头文件和源文件的方式

protoc --cpp_out=./ ./msgType.proto

protoc 命令详解

protoc 貌似不支持绝对路径,这里

Usage: protoc [OPTION] PROTO_FILES
Parse PROTO_FILES and generate output based on the options given:-IPATH, --proto_path=PATH   Specify the directory in which to search forimports.  May be specified multiple times;directories will be searched in order.  If notgiven, the current working directory is used.--version                   Show version info and exit.-h, --help                  Show this text and exit.--encode=MESSAGE_TYPE       Read a text-format message of the given typefrom standard input and write it in binaryto standard output.  The message type mustbe defined in PROTO_FILES or their imports.--decode=MESSAGE_TYPE       Read a binary message of the given type fromstandard input and write it in text formatto standard output.  The message type mustbe defined in PROTO_FILES or their imports.--decode_raw                Read an arbitrary protocol message fromstandard input and write the raw tag/valuepairs in text format to standard output.  NoPROTO_FILES should be given when using thisflag.--descriptor_set_in=FILES   Specifies a delimited list of FILESeach containing a FileDescriptorSet (aprotocol buffer defined in descriptor.proto).The FileDescriptor for each of the PROTO_FILESprovided will be loaded from theseFileDescriptorSets. If a FileDescriptorappears multiple times, the first occurrencewill be used.-oFILE,                     Writes a FileDescriptorSet (a protocol buffer,--descriptor_set_out=FILE defined in descriptor.proto) containing all ofthe input files to FILE.--include_imports           When using --descriptor_set_out, also includeall dependencies of the input files in theset, so that the set is self-contained.--include_source_info       When using --descriptor_set_out, do not stripSourceCodeInfo from the FileDescriptorProto.This results in vastly larger descriptors thatinclude information about the originallocation of each decl in the source file aswell as surrounding comments.--dependency_out=FILE       Write a dependency output file in the formatexpected by make. This writes the transitiveset of input file paths to FILE--error_format=FORMAT       Set the format in which to print errors.FORMAT may be 'gcc' (the default) or 'msvs'(Microsoft Visual Studio format).--print_free_field_numbers  Print the free field numbers of the messagesdefined in the given proto files. Groups sharethe same field number space with the parent message. Extension ranges are counted as occupied fields numbers.--plugin=EXECUTABLE         Specifies a plugin executable to use.Normally, protoc searches the PATH forplugins, but you may specify additionalexecutables not in the path using this flag.Additionally, EXECUTABLE may be of the formNAME=PATH, in which case the given plugin nameis mapped to the given executable even ifthe executable's own name differs.--cpp_out=OUT_DIR           Generate C++ header and source.--csharp_out=OUT_DIR        Generate C# source file.--java_out=OUT_DIR          Generate Java source file.--javanano_out=OUT_DIR      Generate Java Nano source file.--js_out=OUT_DIR            Generate JavaScript source.--objc_out=OUT_DIR          Generate Objective C header and source.--php_out=OUT_DIR           Generate PHP source file.--python_out=OUT_DIR        Generate Python source file.--ruby_out=OUT_DIR          Generate Ruby source file.@<filename>                 Read options and filenames from file. If arelative file path is specified, the filewill be searched in the working directory.The --proto_path option will not affect howthis argument file is searched. Content ofthe file will be expanded in the position of@<filename> as in the argument list. Notethat shell expansion is not applied to thecontent of the file (i.e., you cannot usequotes, wildcards, escapes, commands, etc.).Each line corresponds to a single argument,even if it contains spaces.

Linux下利用protoc命令生成protobuf的头文件和源文件,根据mesType.proto文件相关推荐

  1. Linux下利用nc命令来监控检测服务器的端口使用情况

    检测端口还在用telnet?太落伍把 有没有批量检测的方法?有的.我们用nc就可以快速检测端口的开放性. nc检测端口的用法 nc -z  -w 10  %IP%    %PORT% -z表示检测或者 ...

  2. 在linux下利用ls命令进行模糊查找

    如上图,我们当前路径下有三个文件,分别为helloworld.c以及helloworld和1.c,直接输入命令ls则显示所有文件,我们可以利用ls 加*的方向进行模糊查找. 输入ls 目录名 形式的命 ...

  3. windows下利用批处理命令生成maven项目(java、javaWeb)

    觉得用IDE生成maven项目会卡住,很慢.就用cmd写了个cmd批处理命令来生成maven项目.效果如下 生成项目导入idea后结构如下 批处理命令代码如下 @echo off::echo 请选择项 ...

  4. linux下Vi编辑器命令大全

    linux下Vi编辑器命令大全 /根目录下的文件夹 输入"/",回车 里面有很多文件夹,如:etc,home,lib,mnt等等 etc:存放用户名和密码 home:每个用户有个文 ...

  5. linux dd命令卡住,linux下显示dd命令的进度:

    linux下显示dd命令的进度: dd if=/dev/zero of=/tmp/zero.img bs=10M count=100000 想要查看上面的dd命令的执行进度,可以使用下面几种方法: 比 ...

  6. Linux命令模式下打开摄像头,Linux下利用Opencv打开笔记本摄像头问题

    新建test文件夹,文件夹存在test.cpp和CMakeLists.txttest.cpp#include #include #include #include #include #include ...

  7. linux下利用openssl来实现证书的颁发(详细步骤)--转载和修改

    原文地址:http://www.cnblogs.com/firtree/p/4028354.html linux下利用openssl来实现证书的颁发(详细步骤) 1.首先需要安装openssl,一个开 ...

  8. linux下的ld命令(1)

    使用ld 本文档介绍GNU连接器ld的2.14版本. 本文档在GNU自由文档许可证下发行.在"GNU自由文档许可证"一章中有关于本许可证的一份拷贝. 概述 'ld'把一定量的目标文 ...

  9. linux在指定行添加内容,linux下利用shell在指定的行添加内容的方法

    linux下利用shell在指定的行添加内容的方法 在linux的一些配置中总会要进行某个文件中的某行的操作,进行增加,修改,删除等操作. 而这里主要是进行的是指定的行添加数据的操作: 脚本如下: s ...

最新文章

  1. shell执行mysql命令
  2. JBoss 系列十六:JBoss7/WildFly配置domain模式
  3. tello通信_【我的项目666】+通讯管理(5)modbus-RTU主机
  4. mysql数据库被黑客删除,您做好防范了吗?
  5. 实现定时中断_EPIT 定时器,仅需做到如下几步,即可轻松配置使用
  6. 《JavaScript高级程序设计》读书笔记 ---基本概念小结
  7. [转]Visual Studio 项目类型 GUID 清单
  8. 第96:SVM简介与简单应用
  9. React Hooks的使用(一)——useState、useEffect解析
  10. 深度学习环境搭建之Anaconda安装keras
  11. 美国节日(求某天是星期几)
  12. 解决git 提交报fatal: unable to access ' ': The requested URL returned error: 403 错(亲测可行)
  13. 爬虫之汽车之家/抽屉新热榜/煎蛋网
  14. syswow64删除文件_syswow64 c盘syswow64可以删除吗
  15. 大数据—数据收集系统介绍(Flume,Sqoop)
  16. 关于Intriguing properties of neural networks的理解
  17. LYL程序员小白的理解之简单易懂的Arduino的串口通讯
  18. SRS音频技术介绍一
  19. Nodejs相关ORM框架分析
  20. Linux 重定向与管道

热门文章

  1. 微信小程序内使用echart实现中国地图,点击省跳转省地图,再点击市跳转到市区详情
  2. 爬虫数据存储—数据库和MySQL
  3. 基础数据模板.xlsx下载
  4. 阿里巴巴java社招面试_阿里社招Java面试题总结——面试官分享
  5. 人生百味-10:道与术
  6. MBR16200FCT-ASEMI大功率肖特基二极管MBR16200FCT
  7. 如何制作PDF格式的电子图书
  8. 漫画 | 手把手教你造一个元宇宙
  9. php 在线答题 github,GitHub - xuan89D33/ZCTestOnLine: 利用PHP实现的学生在线考试系统
  10. 中企通信亮相WRE制造业CIO峰会2017