Windows环境下配置thrift编译器(VS2015)

 
 
 
  1. 编译器(thrift代理类生成工具thrift.exe)源码:\compiler\cpp\compiler.sln
  2. 安装flex、bision、m4、regex,配置环境变量(Path中添加:C:\GnuWin32
    http://jaist.dl.sourceforge.net/project/gnuwin32/regex/2.7/regex-2.7-setup.exe
    http://jaist.dl.sourceforge.net/project/gnuwin32/sed/4.2.1/sed-4.2.1-setup.exe
    http://pilotfiber.dl.sourceforge.net/project/gnuwin32/bison/2.4.1/bison-2.4.1-setup.exe
    http://pilotfiber.dl.sourceforge.net/project/gnuwin32/flex/2.5.4a-1/flex-2.5.4a-1.exe
    注意:安装目录中不要有空格,如“C:\Program Files (x86)\GnuWin32”此类目录是不行的,我直接改成“C:\GnuWin32 ” 了。
  3. 重启VS
  4. 编译,报错,缺少:unistd.h
  5. 编译,报错,缺少version.h
    e:\参考资料\thrift\thrift-master\compiler\cpp\src\generate\t_generator.h(30): fatal error C1083: 无法打开包括文件: “version.h”: No such file or directory
    将:\compiler\cpp\version.h.in文件复制到\compiler\cpp\src\下,改名:version.h
  6. 继续编译,通过...
  7. 生成代理类命令:D:\xxx\thrift -gen go/csharp xxxx.thrift,可创建bat文件一键生成
  8. 如需调整thrift代理类默认的生成逻辑,定制自己的thrift代码生成器,修改相应的generate文件即可,如:t_csharp_generator.cc、t_go_generator.cc等,修改后重新编译thrift.exe文件,然后再去生成代码

转载于:https://www.cnblogs.com/lijunhao/p/5952428.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值