這篇文章主要介紹Linux中C++動態(tài)庫編譯的示例分析,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
成都創(chuàng)新互聯(lián)公司秉承實現(xiàn)全網價值營銷的理念,以專業(yè)定制企業(yè)官網,成都網站建設、成都網站制作,成都小程序開發(fā),網頁設計制作,手機網站制作設計,全網營銷推廣幫助傳統(tǒng)企業(yè)實現(xiàn)“互聯(lián)網+”轉型升級專業(yè)定制企業(yè)官網,公司注重人才、技術和管理,匯聚了一批優(yōu)秀的互聯(lián)網技術人才,對客戶都以感恩的心態(tài)奉獻自己的專業(yè)和所長。1 編譯
問題1: configure:error: "Error: libcrypto required."
解決:apt-getinstall libssl-dev
問題2:uint32_tdoes not name a type
解決:
uint32_t定義文件在stdint.h,通過whereis stdint.h
stdint.h: /usr/include/stdint.h
說明在標準的include路徑下,將出現(xiàn)編譯錯誤的源碼文件中添加#include<stdint.h>
問題3:Makefile文件的BOOST庫路徑指定錯誤
解決:
MakeFile文件中:BOOST_DIR = /usr/local/include/boost
而實際的情況卻是:BOOST_DIR=/usr/include/boost
# apt-get installlibboost-dev
已經安裝成功,但是不清楚安裝的位置
查找本地boost庫的安裝目錄:
whereis boost
boost:/usr/include/boost
問題 4:ntohs 存在未定義的編譯錯誤
解決:
包含頭文件#include<arpa/inet.h>
問題5:編譯例子出現(xiàn)thrift庫函數(shù)大量未定義的編譯錯誤
解決:
主要是鏈接-lthrift必須放在CppClient.cppCppServer.cpp的后面,修改Makefile文件,調整兩者的順序即可。當某一個源碼文件編譯找不到函數(shù)定義的時候,只會往后查找函數(shù)定義
問題6:
解決:添加-DHAVE_NETINET_IN_H
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);
以上是“Linux中C++動態(tài)庫編譯的示例分析”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
標題名稱:Linux中C++動態(tài)庫編譯的示例分析-創(chuàng)新互聯(lián)
轉載來于:http://jinyejixie.com/article28/dpopjp.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供虛擬主機、網站維護、品牌網站制作、定制開發(fā)、小程序開發(fā)、Google
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)