使用thrift大量编译警告消息方法

简介: https://issues.apache.org/jira/browse/THRIFT-1824背景:当在使用thrift时,如果我们的代码也采用automake方式编译,这样就存在config.h文件冲突,原因是thrift的Thread.h文件include它时,没有目录修饰。

背景:
当在使用thrift时,如果我们的代码也采用automake方式编译,这样就存在config.h文件冲突,原因是thrift的Thread.h文件include它时,没有目录修饰。


config.h:
在成功编译thrift后,会在它的thrift目录下生成一个config.h文件,这个文件实际是由automake产生的,如下所示 :


> ls thrift
async        config.h   protocol  server                   TDispatchProcessor.h  TLogging.h    transport
concurrency  processor  qt        TApplicationException.h  Thrift.h              TProcessor.h  TReflectionLocal.h



concurrency/Thread.h:
在Thread.h头文件中会包含这个头文件,遗憾的是Thread.h是对外的公共文件,也就是使用thrift会直接看到它,而config.h被include时,未加任何目录修饰,这就是收到大量编译警告的原因。


#ifdef HAVE_CONFIG_H
#include
#endif


ERROR MESSAGE:
只 需要将Thread.h中的#include 注释掉,下面的大量编译警告即可消息,而且thrift编译也没有问题。


make[2]: Entering directory `@_@'
if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I../../../third-party/boost/include -I../../../third-party/thrift/include -I../../../third-party/sqlite/include -I../../../third-party/gflags/include -I../../../third-party/glog/include -I../../../third-party/libevent/include -I../../../third-party/mysql/include    -D_GNU_SOURCE -rdynamic -Wall -fPIC -g -MT ExecutorService_server.skeleton.o -MD -MP -MF ".deps/ExecutorService_server.skeleton.Tpo" -c -o ExecutorService_server.skeleton.o `test -f './ExecutorService_server.skeleton.cpp' || echo './'`./ExecutorService_server.skeleton.cpp; \
then mv -f ".deps/ExecutorService_server.skeleton.Tpo" ".deps/ExecutorService_server.skeleton.Po"; else rm -f ".deps/ExecutorService_server.skeleton.Tpo"; exit 1; fi
In file included from ../../../third-party/thrift/include/thrift/concurrency/Thread.h:28,
                 from ../../../third-party/thrift/include/thrift/server/TServer.h:26,
                 from ../../../third-party/thrift/include/thrift/server/TSimpleServer.h:23,
                 from ./ExecutorService_server.skeleton.cpp:6:
../../config.h:44:1: warning: "PACKAGE" redefined
In file included from ../../../third-party/thrift/include/thrift/TLogging.h:24,
                 from ../../../third-party/thrift/include/thrift/Thrift.h:51,
                 from ../../../third-party/thrift/include/thrift/transport/TTransport.h:23,
                 from ../../../third-party/thrift/include/thrift/protocol/TProtocol.h:23,
                 from ../../../third-party/thrift/include/thrift/TProcessor.h:24,
                 from ../../../third-party/thrift/include/thrift/TDispatchProcessor.h:22,
                 from ./ExecutorService.h:10,
                 from ./ExecutorService_server.skeleton.cpp:4:
../../../third-party/thrift/include/thrift/config.h:263:1: warning: this is the location of the previous definition
In file included from ../../../third-party/thrift/include/thrift/concurrency/Thread.h:28,
                 from ../../../third-party/thrift/include/thrift/server/TServer.h:26,
                 from ../../../third-party/thrift/include/thrift/server/TSimpleServer.h:23,
                 from ./ExecutorService_server.skeleton.cpp:6:
../../config.h:47:1: warning: "PACKAGE_BUGREPORT" redefined
In file included from ../../../third-party/thrift/include/thrift/TLogging.h:24,
                 from ../../../third-party/thrift/include/thrift/Thrift.h:51,
                 from ../../../third-party/thrift/include/thrift/transport/TTransport.h:23,
                 from ../../../third-party/thrift/include/thrift/protocol/TProtocol.h:23,
                 from ../../../third-party/thrift/include/thrift/TProcessor.h:24,
                 from ../../../third-party/thrift/include/thrift/TDispatchProcessor.h:22,
                 from ./ExecutorService.h:10,
                 from ./ExecutorService_server.skeleton.cpp:4:
../../../third-party/thrift/include/thrift/config.h:266:1: warning: this is the location of the previous definition
In file included from ../../../third-party/thrift/include/thrift/concurrency/Thread.h:28,
                 from ../../../third-party/thrift/include/thrift/server/TServer.h:26,
                 from ../../../third-party/thrift/include/thrift/server/TSimpleServer.h:23,
                 from ./ExecutorService_server.skeleton.cpp:6:
../../config.h:50:1: warning: "PACKAGE_NAME" redefined
In file included from ../../../third-party/thrift/include/thrift/TLogging.h:24,
                 from ../../../third-party/thrift/include/thrift/Thrift.h:51,
                 from ../../../third-party/thrift/include/thrift/transport/TTransport.h:23,
                 from ../../../third-party/thrift/include/thrift/protocol/TProtocol.h:23,
                 from ../../../third-party/thrift/include/thrift/TProcessor.h:24,
                 from ../../../third-party/thrift/include/thrift/TDispatchProcessor.h:22,
                 from ./ExecutorService.h:10,
                 from ./ExecutorService_server.skeleton.cpp:4:
../../../third-party/thrift/include/thrift/config.h:269:1: warning: this is the location of the previous definition
In file included from ../../../third-party/thrift/include/thrift/concurrency/Thread.h:28,
                 from ../../../third-party/thrift/include/thrift/server/TServer.h:26,
                 from ../../../third-party/thrift/include/thrift/server/TSimpleServer.h:23,
                 from ./ExecutorService_server.skeleton.cpp:6:
../../config.h:53:1: warning: "PACKAGE_STRING" redefined
In file included from ../../../third-party/thrift/include/thrift/TLogging.h:24,
                 from ../../../third-party/thrift/include/thrift/Thrift.h:51,
                 from ../../../third-party/thrift/include/thrift/transport/TTransport.h:23,
                 from ../../../third-party/thrift/include/thrift/protocol/TProtocol.h:23,
                 from ../../../third-party/thrift/include/thrift/TProcessor.h:24,
                 from ../../../third-party/thrift/include/thrift/TDispatchProcessor.h:22,
                 from ./ExecutorService.h:10,
                 from ./ExecutorService_server.skeleton.cpp:4:
../../../third-party/thrift/include/thrift/config.h:272:1: warning: this is the location of the previous definition
In file included from ../../../third-party/thrift/include/thrift/concurrency/Thread.h:28,
                 from ../../../third-party/thrift/include/thrift/server/TServer.h:26,
                 from ../../../third-party/thrift/include/thrift/server/TSimpleServer.h:23,
                 from ./ExecutorService_server.skeleton.cpp:6:
../../config.h:56:1: warning: "PACKAGE_TARNAME" redefined
In file included from ../../../third-party/thrift/include/thrift/TLogging.h:24,
                 from ../../../third-party/thrift/include/thrift/Thrift.h:51,
                 from ../../../third-party/thrift/include/thrift/transport/TTransport.h:23,
                 from ../../../third-party/thrift/include/thrift/protocol/TProtocol.h:23,
                 from ../../../third-party/thrift/include/thrift/TProcessor.h:24,
                 from ../../../third-party/thrift/include/thrift/TDispatchProcessor.h:22,
                 from ./ExecutorService.h:10,
                 from ./ExecutorService_server.skeleton.cpp:4:
../../../third-party/thrift/include/thrift/config.h:275:1: warning: this is the location of the previous definition
In file included from ../../../third-party/thrift/include/thrift/concurrency/Thread.h:28,
                 from ../../../third-party/thrift/include/thrift/server/TServer.h:26,
                 from ../../../third-party/thrift/include/thrift/server/TSimpleServer.h:23,
                 from ./ExecutorService_server.skeleton.cpp:6:
../../config.h:59:1: warning: "PACKAGE_VERSION" redefined
In file included from ../../../third-party/thrift/include/thrift/TLogging.h:24,
                 from ../../../third-party/thrift/include/thrift/Thrift.h:51,
                 from ../../../third-party/thrift/include/thrift/transport/TTransport.h:23,
                 from ../../../third-party/thrift/include/thrift/protocol/TProtocol.h:23,
                 from ../../../third-party/thrift/include/thrift/TProcessor.h:24,
                 from ../../../third-party/thrift/include/thrift/TDispatchProcessor.h:22,
                 from ./ExecutorService.h:10,
                 from ./ExecutorService_server.skeleton.cpp:4:
../../../third-party/thrift/include/thrift/config.h:281:1: warning: this is the location of the previous definition
In file included from ../../../third-party/thrift/include/thrift/concurrency/Thread.h:28,
                 from ../../../third-party/thrift/include/thrift/server/TServer.h:26,
                 from ../../../third-party/thrift/include/thrift/server/TSimpleServer.h:23,
                 from ./ExecutorService_server.skeleton.cpp:6:
../../config.h:65:1: warning: "VERSION" redefined
In file included from ../../../third-party/thrift/include/thrift/TLogging.h:24,
                 from ../../../third-party/thrift/include/thrift/Thrift.h:51,
                 from ../../../third-party/thrift/include/thrift/transport/TTransport.h:23,
                 from ../../../third-party/thrift/include/thrift/protocol/TProtocol.h:23,
                 from ../../../third-party/thrift/include/thrift/TProcessor.h:24,
                 from ../../../third-party/thrift/include/thrift/TDispatchProcessor.h:22,
                 from ./ExecutorService.h:10,
                 from ./ExecutorService_server.skeleton.cpp:4:
../../../third-party/thrift/include/thrift/config.h:327:1: warning: this is the location of the previous definition
相关文章
|
弹性计算 大数据 Linux
飞天加速计划初体验
最近因需要使用云服务器来学习,老师让我们用这个阿里云类进行相关的学习,让我们先进行免费的使用进行学习,慢慢了解,毕竟对于首次接触的事物都是了解为主不会投入大量资金。阿里云平台有详细的教程,让初学者能十分轻松的进行学习。飞天加速计划是个好想法,可以让我们这些学生进行学习,制作出自己的网站。让我在暑假对计算机有了浓厚的兴趣,于是在阿里云我选择了飞天加速计划,学习大数据和服务器啥的,让自己get到更多的知识~
|
1天前
|
监控 网络协议 算法
2026年起SSL证书有效期逐年缩短:企业如何避免“续期风暴”!
SSL证书有效期将从2026年起分三阶段逐步缩短至47天,人工续期难以为继。阿里云“WoSign SSL证书+自动化服务”,支持域名监控、自动托管、云产品/服务器一键部署及智能提醒,助力企业高效应对高频续期挑战。
8059 2
|
10天前
|
域名解析 人工智能 Linux
|
21天前
|
Linux Go 开发工具
手机上跑 DeepSeek 智能体:开源安卓客户端 DSH Go 安装与使用指南
DSH Go 是一款开源安卓客户端,将 DeepSeek Harness 智能体引擎装进手机:免 Root、免 Termux,一键安装即用;支持本机运行(内置 Ubuntu+Node.js)或远程接管电脑会话;具备插话打断、过程折叠、屏幕操控、端到端加密分享等特色功能,真正实现智能体“口袋化”。
18350 63
|
18天前
|
人工智能
Google 提示「所在地区不可用」?进不去 Antigravity 或 Gemini,先查账号这个设置
进不去 Antigravity 或 Gemini,提示所在地区不可用?三步查清 Google 账号关联地区、官方更正表单理由选法与改区注意事项。
Google 提示「所在地区不可用」?进不去 Antigravity 或 Gemini,先查账号这个设置
|
4天前
|
人工智能 安全 网络安全
|
2天前
|
人工智能 弹性计算 安全
阿里云 码上2027 AI coding 嘉年华
阿里云“码上2027”AI Coding嘉年华于2026年12月2—3日在上海西岸艺术中心举行,聚焦AI Coding从单点提效迈向企业级研发体系升级。发布Qwen4-max模型、QBot智能协作、AgentCore平台等重磅成果,并推出ECS云服务器特惠(200Mbps流量月付40元起)。
782 0
|
8天前
|
云安全 数据采集 人工智能
|
9天前
|
Linux API iOS开发
【DSH】DeepSeek Harness新手保姆教程(下载+安装+配置+使用,2026最新实测)
DeepSeek Harness(dsh)是 DeepSeek AI 开源的智能体框架,秉持“一切皆插件”理念,支持读文件、改代码、执行命令、处理表格等自动化任务;免费开源,兼容 Win/macOS,需配 API 密钥使用。(239字)
1483 5
|
16天前
|
人工智能 开发工具 开发者
2026最新codex下载安装保姆级使用教程(下载+安装+登录+使用,含所有历史版本)
Codex 是 OpenAI 推出的开源 AI 编程智能体,跑在本地终端和桌面客户端里,能读懂整个代码仓库,一句自然语言就能让它改代码、执行命令、跑测试、修 Bug,支持 Windows、macOS、Linux 三大平台。本文把 Codex下载、安装、登录、汉化、基础使用一次讲全,并整理了国内用户最常踩的坑,跟着做 10 分钟就能跑起来。
2617 8