編譯指令apache
g++ UploadMessageService_server.skeleton.cpp uploadmessageservice.cpp thriftcom_types.cpp thriftcom_constants.cpp pushmessageservice.cpp -lthrift-0.9.0 -lpthread -lcrypto -lssl -I /home -I ./ -L. -L /home/dong/3thrdparty/openssl-1.0.2j -fpermissive -o output -DHAVE_NETINET_IN_Hide
問題1)ui
In file included from /home/thrift/protocol/TBinaryProtocol.h:280:0,
from UploadMessageService_server.skeleton.cpp:5:
/home/thrift/protocol/TBinaryProtocol.tcc: In member function ‘uint32_t apache::thrift::protocol::TBinaryProtocolT<Transport_>::writeI16(int16_t)’:
/home/thrift/protocol/TBinaryProtocol.tcc:147:26: warning: there are no arguments to ‘htons’ that depend on a template parameter, so a declaration of ‘hton’ must be available [-fpermissive]
int16_t net = (int16_t)htons(i16);
^~~~~
/home/thrift/protocol/TBinaryProtocol.tcc: In member function ‘uint32_t apache::thrift::protocol::TBinaryProtocolT<Transport_>::writeI32(int32_t)’:
/home/thrift/protocol/TBinaryProtocol.tcc:154:26: warning: there are no arguments to ‘htonl’ that depend on a template parameter, so a declaration of ‘hton’ must be available [-fpermissive]
int32_t net = (int32_t)htonl(i32);
^~~~~
/home/thrift/protocol/TBinaryProtocol.tcc: In instantiation of ‘uint32_t apache::thrift::protocol::TBinaryProtocolT<Transport_>::writeI16(int16_t) [with Transport_ = apache::thrift::transport::TTransport; uint32_t = unsigned int; int16_t = short int]’:
/home/thrift/protocol/TVirtualProtocol.h:401:55: required from ‘uint32_t apache::thrift::protocol::TVirtualProtocol<Protocol_, Super_>::writeI16_virt(int16_t) [with Protocol_ = apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>; Super_ = apache::thrift::protocol::TProtocolDefaults; uint32_t = unsigned int; int16_t = short int]’
UploadMessageService_server.skeleton.cpp:89:1: required from here
/home/thrift/protocol/TBinaryProtocol.tcc:147:31: error: ‘htons’ was not declared in this scope
int16_t net = (int16_t)htons(i16);
~~~~~^~~~~
/home/thrift/protocol/TBinaryProtocol.tcc:147:31: note: suggested alternative: ‘htonll’
int16_t net = (int16_t)htons(i16);
~~~~~^~~~~
htonll
/home/thrift/protocol/TBinaryProtocol.tcc: In instantiation of ‘uint32_t apache::thrift::protocol::TBinaryProtocolT<Transport_>::writeI32(int32_t) [with Transport_ = apache::thrift::transport::TTransport; uint32_t = unsigned int; int32_t = int]’:
/home/thrift/protocol/TVirtualProtocol.h:405:55: required from ‘uint32_t apache::thrift::protocol::TVirtualProtocol<Protocol_, Super_>::writeI32_virt(int32_t) [with Protocol_ = apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>; Super_ = apache::thrift::protocol::TProtocolDefaults; uint32_t = unsigned int; int32_t = int]’
UploadMessageService_server.skeleton.cpp:89:1: required from here
/home/thrift/protocol/TBinaryProtocol.tcc:154:31: error: ‘htonl’ was not declared in this scope
int32_t net = (int32_t)htonl(i32);
~~~~~^~~~~
/home/thrift/protocol/TBinaryProtocol.tcc:154:31: note: suggested alternative: ‘htonll’
int32_t net = (int32_t)htonl(i32);
~~~~~^~~~~
htonll
In file included from /home/thrift/protocol/TBinaryProtocol.h:280:0,
from UploadMessageService_server.skeleton.cpp:5:
/home/thrift/protocol/TBinaryProtocol.tcc: In instantiation of ‘uint32_t apache::thrift::protocol::TBinaryProtocolT<Transport_>::readI16(int16_t&) [with Transport_ = apache::thrift::transport::TTransport; uint32_t = unsigned int; int16_t = short int]’:
/home/thrift/protocol/TVirtualProtocol.h:499:54: required from ‘uint32_t apache::thrift::protocol::TVirtualProtocol<Protocol_, Super_>::readI16_virt(int16_t&) [with Protocol_ = apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>; Super_ = apache::thrift::protocol::TProtocolDefaults; uint32_t = unsigned int; int16_t = short int]’
UploadMessageService_server.skeleton.cpp:89:1: required from here
/home/thrift/protocol/TBinaryProtocol.tcc:365:23: error: ‘ntohs’ was not declared in this scope
i16 = (int16_t)ntohs(theBytes.all);
~~~~~^~~~~~~~~~~~~~
/home/thrift/protocol/TBinaryProtocol.tcc:365:23: note: suggested alternative: ‘ntohll’
i16 = (int16_t)ntohs(theBytes.all);
~~~~~^~~~~~~~~~~~~~
ntohll
/home/thrift/protocol/TBinaryProtocol.tcc: In instantiation of ‘uint32_t apache::thrift::protocol::TBinaryProtocolT<Transport_>::readI32(int32_t&) [with Transport_ = apache::thrift::transport::TTransport; uint32_t = unsigned int; int32_t = int]’:
/home/thrift/protocol/TVirtualProtocol.h:503:54: required from ‘uint32_t apache::thrift::protocol::TVirtualProtocol<Protocol_, Super_>::readI32_virt(int32_t&) [with Protocol_ = apache::thrift::protocol::TBinaryProtocolT<apache::thrift::transport::TTransport>; Super_ = apache::thrift::protocol::TProtocolDefaults; uint32_t = unsigned int; int32_t = int]’
UploadMessageService_server.skeleton.cpp:89:1: required from here
/home/thrift/protocol/TBinaryProtocol.tcc:376:23: error: ‘ntohl’ was not declared in this scope
i32 = (int32_t)ntohl(theBytes.all);
~~~~~^~~~~~~~~~~~~~
/home/thrift/protocol/TBinaryProtocol.tcc:376:23: note: suggested alternative: ‘ntohll’
i32 = (int32_t)ntohl(theBytes.all);this
解決:添加-DHAVE_NETINET_IN_Hspa