中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Linux中C++動態庫編譯的示例分析

發布時間:2021-10-18 15:05:28 來源:億速云 閱讀:252 作者:小新 欄目:編程語言

這篇文章主要介紹Linux中C++動態庫編譯的示例分析,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

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路徑下,將出現編譯錯誤的源碼文件中添加#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:編譯例子出現thrift庫函數大量未定義的編譯錯誤

解決:

主要是鏈接-lthrift必須放在CppClient.cppCppServer.cpp的后面,修改Makefile文件,調整兩者的順序即可。當某一個源碼文件編譯找不到函數定義的時候,只會往后查找函數定義

問題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++動態庫編譯的示例分析”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

林西县| 河西区| 太湖县| 方城县| 古蔺县| 焦作市| 通榆县| 阳信县| 西盟| 阳东县| 克东县| 长海县| 古丈县| 故城县| 元谋县| 乌拉特后旗| 柞水县| 满城县| 文成县| 峨眉山市| 泊头市| 田林县| 延长县| 哈密市| 铁力市| 体育| 航空| 轮台县| 长武县| 三亚市| 九龙坡区| 沁阳市| 朔州市| 沈阳市| 凤庆县| 济阳县| 襄垣县| 青神县| 科技| 英山县| 霍林郭勒市|