Linux Thrift hello world 编译报错 求助

carlos1520 2018-09-21 03:48:57
编译时遇到一些 未定义错误,有遇到过的吗 怎么解决?
好多 stdcxx里的错误

[gen-cpp]$ make
if [ ! -d ./obj ]; then mkdir -p ./obj; fi
if [ ! -d ./obj/src ]; then mkdir -p ./obj/src; fi
/opt/compiler/gcc-4.8.2/bin/g++ -c ./demo_server.cpp -o obj/./demo_server.o -I. -I/home/carlos/bin/thrift/include/ -I/home/carlos/bin/boost_1_49_0/include/
In file included from /home/carlos/bin/thrift/include/thrift/transport/TTransport.h:24:0,
from /home/carlos/bin/thrift/include/thrift/protocol/TProtocol.h:28,
from /home/carlos/bin/thrift/include/thrift/TProcessor.h:24,
from /home/carlos/bin/thrift/include/thrift/TDispatchProcessor.h:22,
from ./UserStorage.h:10,
from ./demo_server.cpp:1:
/home/carlos/bin/thrift/include/thrift/stdcxx.h:61:18: error: ‘std::bind’ has not been declared
using ::std::bind;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:62:18: error: ‘std::function’ has not been declared
using ::std::function;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:65:20: error: ‘std::placeholders’ has not been declared
using ::std::placeholders::_1;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:66:20: error: ‘std::placeholders’ has not been declared
using ::std::placeholders::_2;

^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:69:20: error: ‘std::placeholders’ has not been declared
using ::std::placeholders::_5;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:70:20: error: ‘std::placeholders’ has not been declared
using ::std::placeholders::_6;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:71:20: error: ‘std::placeholders’ has not been declared
using ::std::placeholders::_7;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:72:20: error: ‘std::placeholders’ has not been declared
using ::std::placeholders::_8;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:73:20: error: ‘std::placeholders’ has not been declared
using ::std::placeholders::_9;
^
In file included from /home/carlos/bin/thrift/include/thrift/transport/TTransport.h:24:0,
from /home/carlos/bin/thrift/include/thrift/protocol/TProtocol.h:28,
from /home/carlos/bin/thrift/include/thrift/TProcessor.h:24,
from /home/carlos/bin/thrift/include/thrift/TDispatchProcessor.h:22,
from ./UserStorage.h:10,
from ./demo_server.cpp:1:
/home/carlos/bin/thrift/include/thrift/stdcxx.h:111:16: error: ‘std::const_pointer_cast’ has not been declared
using ::std::const_pointer_cast;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:112:16: error: ‘std::dynamic_pointer_cast’ has not been declared
using ::std::dynamic_pointer_cast;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:113:16: error: ‘std::enable_shared_from_this’ has not been declared
using ::std::enable_shared_from_this;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:114:16: error: ‘std::make_shared’ has not been declared
using ::std::make_shared;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:115:25: error: expected unqualified-id before ‘using’
template <typename T> using scoped_ptr = std::unique_ptr<T>; // compiler must support template aliasing
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:116:16: error: ‘std::shared_ptr’ has not been declared
using ::std::shared_ptr;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:117:16: error: ‘std::static_pointer_cast’ has not been declared
using ::std::static_pointer_cast;
^
/home/carlos/bin/thrift/include/thrift/stdcxx.h:118:16: error: ‘std::weak_ptr’ has not been declared
using ::std::weak_ptr;

...
...
...

/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: In member function ‘virtual bool apache::thrift::transport::TBufferedTransport::isOpen()’:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:220:26: error: ‘transport_’ was not declared in this scope
bool isOpen() { return transport_->isOpen(); }
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: In member function ‘virtual bool apache::thrift::transport::TBufferedTransport::peek()’:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:224:34: error: ‘transport_’ was not declared in this scope
setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: In member function ‘virtual void apache::thrift::transport::TBufferedTransport::close()’:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:231:5: error: ‘transport_’ was not declared in this scope
transport_->close();
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: In member function ‘virtual const string apache::thrift::transport::TBufferedTransport::getOrigin()’:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:243:50: error: ‘transport_’ was not declared in this scope
virtual const std::string getOrigin() { return transport_->getOrigin(); }
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: At global scope:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:294:11: error: ‘shared_ptr’ in namespace ‘apache::thrift::stdcxx’ does not name a type
virtual stdcxx::shared_ptr<TTransport> getTransport(stdcxx::shared_ptr<TTransport> trans) {
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:322:38: error: expected ‘)’ before ‘<‘ token
TFramedTransport(stdcxx::shared_ptr<TTransport> transport)

/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:369:3: error: ‘shared_ptr’ in namespace ‘apache::thrift::stdcxx’ does not name a type
stdcxx::shared_ptr<TTransport> getUnderlyingTransport() { return transport_; }
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:410:3: error: ‘shared_ptr’ in namespace ‘apache::thrift::stdcxx’ does not name a type
stdcxx::shared_ptr<TTransport> transport_;
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: In constructor ‘apache::thrift::transport::TFramedTransport::TFramedTransport()’:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:313:7: error: class ‘apache::thrift::transport::TFramedTransport’ does not have any field named ‘transport_’
: transport_(),
^
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: In member function ‘virtual bool apache::thrift::transport::TFramedTransport::peek()’:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:350:46: error: ‘transport_’ was not declared in this scope
bool peek() { return (rBase_ < rBound_) || transport_->peek(); }
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: In member function ‘virtual void apache::thrift::transport::TFramedTransport::close()’:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:354:5: error: ‘transport_’ was not declared in this scope
transport_->close();
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: In member function ‘virtual const string apache::thrift::transport::TFramedTransport::getOrigin()’:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:380:50: error: ‘transport_’ was not declared in this scope
virtual const std::string getOrigin() { return transport_->getOrigin(); }
^
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h: At global scope:
/home/carlos/bin/thrift/include/thrift/transport/TBufferTransports.h:433:11: error: ‘shared_ptr’ in namespace ‘apache::thrift::stdcxx’ does not name a type
virtual stdcxx::shared_ptr<TTransport> getTransport(stdcxx::shared_ptr<TTransport> trans) {
^


MakeFile 如下BINNAME = thrift_server

DEP_ROOT = ./
INTERFACE_ROOT = ./

INC_PATH = -I.
INC_PATH += -I/home/wangxiangxi/bin/thrift/include/
INC_PATH += -I/home/wangxiangxi/bin/boost_1_49_0/include/

LIB_PATH = -Llib
LIB_PATH += -L/home/wangxiangxi/bin/thrift/lib

CXX = /opt/compiler/gcc-4.8.2/bin/g++
OUTPUT_PATH = ./output
VERSION=${shell echo $$SCMPF_MODULE_VERSION}

LDFLAGS = -lthrift

OBJ_DIR = ./obj
SRC_DIR = .
SOURCES = $(wildcard $(SRC_DIR)/*.cpp)

OBJS = $(patsubst %.cpp, $(OBJ_DIR)/%.o, $(SOURCES))
all: objdir outputdir
objdir:
if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi
if [ ! -d $(OBJ_DIR)/src ]; then mkdir -p $(OBJ_DIR)/src; fi
outputdir: output

if [ ! -d $(OUTPUT_PATH) ]; then mkdir -p $(OUTPUT_PATH); fi
if [ ! -d $(OUTPUT_P ATH)/conf ]; then mkdir -p $(OUTPUT_PATH)/conf; fi

output: $(OBJS)
$(CXX) -o $(BINNAME) $(OBJS_BIDL) $(OBJS) $(INC_PATH) $(LIB_PATH) $(LDFLAGS)

$(OBJ_DIR)/%.o: %.cpp
$(CXX) -c $< -o $@ $(INC_PATH)
clean:
rm -f $(BINNAME)

用的boost 还得是 1.49.0 以前的 新版本没有 tr1 。。。
...全文
635 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
rendao0563 2018-09-28
  • 打赏
  • 举报
回复
gcc 版本太低 升级一下.
carlos1520 2018-09-26
  • 打赏
  • 举报
回复
试了 还是不行 还是提示一堆未定义
林多 2018-09-24
  • 打赏
  • 举报
回复
MakeFile里面加个
CXXFLAGS = -std=c++11
试试看

64,670

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧