参考:http://running.iteye.com/blog/1983463  thrift-0.9.0安装

最好切换到root用户操作,避免不必要的麻烦。

进行例子程序tutorial目录下,通过thrift 命令生成gen-cpp后,进入cpp文件夹用make编译时出现错误,我们查看一下Makefile:

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# BOOST_DIR = /usr/local/boost/include/boost-1_33_1/
THRIFT_DIR = /usr/local/include/thrift
LIB_DIR = /usr/local/lib GEN_SRC = ../gen-cpp/SharedService.cpp ../gen-cpp/shared_types.cpp ../gen-cpp/tutorial_types.cpp ../gen-cpp/Calculator.cpp default: server client server: CppServer.cpp
g++ -o CppServer -I${THRIFT_DIR} -I${BOOST_DIR} -I../gen-cpp -L${LIB_DIR} -lthrift CppServer.cpp ${GEN_SRC} client: CppClient.cpp
g++ -o CppClient -I${THRIFT_DIR} -I${BOOST_DIR} -I../gen-cpp -L${LIB_DIR} -lthrift CppClient.cpp ${GEN_SRC} clean:
$(RM) -r CppClient CppServer

在g++ 后添加

-DHAVE_NETINET_IN_H -DHAVE_PTHREAD_H 。

变成:

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# BOOST_DIR = /usr/local/boost/include/boost-1_33_1/
THRIFT_DIR = /usr/local/include/thrift
LIB_DIR = /usr/local/lib GEN_SRC = ../gen-cpp/SharedService.cpp ../gen-cpp/shared_types.cpp ../gen-cpp/tutorial_types.cpp ../gen-cpp/Calculator.cpp default: server client server: CppServer.cpp
g++ -DHAVE_NETINET_IN_H -DHAVE_PTHREAD_H -o CppServer -I${THRIFT_DIR} -I${BOOST_DIR} -I../gen-cpp -L${LIB_DIR} -lthrift CppServer.cpp ${GEN_SRC} client: CppClient.cpp
g++ -DHAVE_NETINET_IN_H -DHAVE_PTHREAD_H -o CppClient -I${THRIFT_DIR} -I${BOOST_DIR} -I../gen-cpp -L${LIB_DIR} -lthrift CppClient.cpp ${GEN_SRC} clean:
$(RM) -r CppClient CppServer

这样再使用make编译就可以了。使用ls查看一下已经生成了server 和 client。运行一下

centos下apache thrift的安装的更多相关文章

  1. centos下apache+mysql+php安装及配置

    今天难得休闲,自从加盟当前公司以来好像就基本没有写过博客了.难得闲下来和前同事聊天,他们几个人合伙买了VPS在用.这对我们搞WEB开发的童鞋来说是非常重要的,我来这家公司有许久了,但是竟然到现在连一台 ...

  2. centos下apache安装后无法访问

    2013.11.28遇到的问题: -------------------------------------- 一.centos下apache安装后无法访问 得查一下防火墙的问题 iptables添加 ...

  3. centos下 Apache、php、mysql默认安装路径

    centos下 Apache.php.mysql默认安装路径 http://blog.sina.com.cn/s/blog_4b8481f70100ujtp.html apache: 如果采用RPM包 ...

  4. Linux下apache+phppgadmin+postgresql安装配置

    Linux下apache+phppgadmin+postgresql安装配置 操作系统:CentOS 安装包:httpd(首选yum), php(包括php以及php-pgsql,php-mbstri ...

  5. CentOS下Apache开启Gzip网页压缩功能

    1.进入/etc/httpd/conf下打开httpd.conf文件 开启Gzip压缩功能,即去掉LoadModule deflate_module modules/mod_deflate.so这行前 ...

  6. CentOS下Apache配置多域名或者多端口映射

    CentOS下Apache默认网站根目录为/var/www/html,假如我默认存了一个CI项目在html文件夹里,同时服务器的外网IP为ExampleIp,因为使用的是MVC框架,Apache需开启 ...

  7. centos 下 Qt Creator 的安装使用

    centos 下 Qt Creator 的安装使用 Qt 以其开源,免费,完全面向对象(很容易扩展),允许真正的组件编程以及可移植跨平台等诸多优势得到越来越多的开发人员的青睐.Qt Creator 是 ...

  8. CentOS下apache绑定域名

    本文主要介绍在CentOS下apache绑定域名以及apache绑定多个域名,首先要找到apache的配置文件httpd.conf的位置.CentOS操作系统一般在 /etc/httpd/conf 下 ...

  9. CentOS下Samba文件服务器的安装与配置

    CentOS下Samba文件服务器的安装与配置 http://blog.csdn.net/limingzhong198/article/details/22064801 一.安装配置 1. 安装sam ...

随机推荐

  1. LLDB中的小技巧

    1.打印视图层次结构 po [self.view recursiveDescription]   2.临时调整界面UI      比如说现在你需要改变一个控件的背景色来更好的查看布局的问题,这是就不需 ...

  2. iOS中判断消息推送是否打开

    根据 [[UIApplication sharedApplication] enabledRemoteNotificationTypes] 的返回值来进行判断,该返回值是一个枚举值,如下: typed ...

  3. 交换机access与trunk口

    理论知识: 以太网端口二种链路类型:Access 和Trunk. Access 类型的端口:只能属于1 个VLAN,一般用于连接计算机的端口: Trunk 类型的端口:可以允许多个VLAN 通过,可以 ...

  4. 设计模式之 Observer Pattern 观察者模式

    1.Subject通过一个容器保存零到多个Observer. 2.Subject通过Add,Delete方法调整Observer. 3.Subject的notifyObservers方法实际是逐个调用 ...

  5. 零售ERP开发(一)

    随着企业信息化不断提高,各种企业管理系统应用而生:怎么才能开发一套简洁.易用.功能健全的管理系统,尤其是能够帮助企业做出重大策略的系统,一致是我们追求的目标.近些年,接触的Erp系统主要包括国内比较知 ...

  6. npm install express -g出错

    npm ERR! Windows_NT npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program ...

  7. Object之魔术函数__call() 处理错误调用

    在提到__call之前,先来看一个实例的测试结果,以便更好地去了解__call方法的作用.上代码: <?php class Person{ function say(){ echo " ...

  8. 谈谈python中的 lambda

    最近刚开始学习python,然后要加几个python的群去学习学习,但是呢有个群的申请栏要求写一个用lambda求1-100的和.....然后悲剧的就是不会啊....然后就没有然后了... 所以去网上 ...

  9. 转: QtCreator调试程序时GDB崩溃

    这个情况出现在QtCreator的2.5版以上,是由于新版QtCreator至少需要7.2 IIRC版的GDB.可以到:http://builds.qt-project.org/job/gdb-win ...

  10. spm使用之七不用seajs改用headjs起步

    这几天在看phpwind官方网站, 他们的前端用了一个叫做head.js的js加载器, 官方网站在 http://headjs.com/ 号称是你只需要在你的html文件中的<head>& ...