VC2008编译libthrift

来源:互联网 发布:交易软件登录不了 编辑:程序博客网 时间:2024/05/21 15:04

VC2008编译libthrift

(金庆的专栏)


thrift只提供了VC2010的sln文件。


用Project From Existing Code... 创建工程。
将 cpp/src/thrift 加入工程。

在Solution Explorer中,
去除 qt 目录。

添加 boost 包含目录。

添加 src 为包含目录,不然 #include <thrift/Thrift.h> 出错。

VC2008缺少 stdint.h, 创建到thrift/windows目录下,并添加为include目录。

#pragma once
#include <boost/cstdint.hpp>
typedef boost::int8_t int8_t;
...
typedef boost::uint64_t uint64_t;

#define INT8_MIN (-128)
...
#define UINT64_MAX (UINT64_C(18446...))

去除VC2010 thrift.sln中没有的文件,无法编译:
Mutex.cpp, PosixThreadFactory.cpp, Monitor.cpp
TEvhttpClientChannel.cpp TEvhttpServer.cpp
TServer.cpp TNonblockingServer.cpp
TSSLSocket.cpp TSSLServerSocket.cpp
TZlibTransport.cpp


加上宏 HAVE_CONFIG_H, 或者 force include force_inc.h.

windows/tr1/functional中
#include <functional>
改为
#include <boost/tr1/functional.hpp>