在 Windows 中使用 Apache Thrift

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5842637/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:45:41  来源:igfitidea点击:

Using Apache Thrift in Windows

c++windowsvisual-studio-2010visual-c++thrift

提问by Pat

I'm interested in compiling Thrift-generated code and linking to the thrift C++ library in a windows environment. Doing some research, I found a few recent links:

我对在 Windows 环境中编译 Thrift 生成的代码和链接到 thrift C++ 库感兴趣。做了一些研究,我发现了一些最近的链接:

1) Thrift Win32 Installation Using Cygwin/MinGW

1)使用 Cygwin/MinGW 安装 Thrift Win32

2) THRIFT-1031and THRIFT-1123 patches to compile in MS Visual C++

2)在 MS Visual C++ 中编译的THRIFT-1031和 THRIFT-1123 补丁

Using #1, I was able to compile a linux library using MinGW, named libthrift.a. But what I would REALLY like to do is be able to generate Thrift code, and compile it IN WINDOWS using a Thrift dll or lib.

使用 #1,我能够使用 MinGW 编译一个名为 libthrift.a 的 linux 库。但我真正想做的是能够生成 Thrift 代码,并使用 Thrift dll 或 lib 在 WINDOWS 中编译它。

In other words, I see how I can use MinGW to compile Thrift code that EXECUTES in Windows. But I want to be able to DEVELOP AND COMPILE code that uses Thrift, in Windows. Is this possible?

换句话说,我看到了如何使用 MinGW 编译在 Windows 中执行的 Thrift 代码。但我希望能够在 Windows 中开发和编译使用 Thrift 的代码。这可能吗?

If not, I suppose #2 is my only option, but it seems to be still highly in development phase.

如果没有,我想 #2 是我唯一的选择,但它似乎仍处于开发阶段。

Any ideas?

有任何想法吗?

采纳答案by werboitu

There′s a patch available to copile the thrift runtime with visual studio c++. It would be great if the thift developers put this patch in the main code.

有一个补丁可用于使用 Visual Studio C++ 编译 thrift 运行时。如果小偷开发者将此补丁放在主代码中,那就太好了。

https://issues.apache.org/jira/browse/THRIFT-591

https://issues.apache.org/jira/browse/THRIFT-591

回答by pmont

Thrift 0.8 has Visual Studio 2010 projects for the Thrift compilier and library. A number of contributors have put in alot of hard work to support Windows VS development. The 0.8 dev release may be downloaded as a snapshot or via SVN http://thrift.apache.org/download/

Thrift 0.8 具有用于 Thrift 编译器和库的 Visual Studio 2010 项目。许多贡献者付出了很多努力来支持 Windows VS 开发。0.8 开发版可以作为快照下载或通过 SVN http://thrift.apache.org/download/

I've created projects using Thrift in VS and it works great.

我已经在 VS 中使用 Thrift 创建了项目,并且效果很好。

回答by ap-osd

Thrift 0.10.0 has much better support for building on Windows.

Thrift 0.10.0 对在 Windows 上构建有更好的支持。

  1. Visual Studio projects in the source which is the recommended approach on the official site.
  2. CMake generated Visual Studio C++ projects which is not documented on the official site but turns out to be more convenient.
  1. 源代码中的 Visual Studio 项目,这是官方网站上推荐的方法。
  2. CMake 生成了 Visual Studio C++ 项目,官方网站上没有记录,但结果证明更方便。

See Apache Thrift on Windowsfor detailed steps.

有关详细步骤,请参阅Windows 上的 Apache Thrift