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文件,然后再去生成代码


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM