In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the example analysis of C++ dynamic library compilation in Linux, which is very detailed and has certain reference value. Interested friends must finish reading it!
1 compilation
Question 1: configure:error: "Error: libcrypto required."
Solution: apt-getinstall libssl-dev
Problem 2:uint32_tdoes not name a type
Resolve:
The uint32_t definition file is in stdint.h, via whereis stdint.h
Stdint.h: / usr/include/stdint.h
Indicates that under the standard include path, # include will be added to the source file where compilation errors occur.
The BOOST library path of the problem 3:Makefile file was specified incorrectly
Resolve:
In the MakeFile file: BOOST_DIR = / usr/local/include/boost
But the actual situation is: BOOST_DIR=/usr/include/boost
# apt-get installlibboost-dev
The installation has been successful, but the location of the installation is not clear
Find the installation directory of the local boost library:
Whereis boost
Boost:/usr/include/boost
Problem there is an undefined compilation error in 4:ntohs
Resolve:
Include header file # include
Problem 5: there are a large number of undefined compilation errors in the compilation example of thrift library functions.
Resolve:
Mainly links-lthrift must be placed after the CppClient.cppCppServer.cpp, modify the Makefile file, and adjust the order of the two. When a source file compiler cannot find the function definition, it will only look for the function definition later.
Question 6:
Resolution: add-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::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::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::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::writeI16_virt (int16_t) [with Protocol_ = apache::thrift::protocol::TBinaryProtocolT; 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::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::writeI32_virt (int32_t) [with Protocol_ = apache::thrift::protocol::TBinaryProtocolT; 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::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::readI16_virt (int16_t&) [with Protocol_ = apache::thrift::protocol::TBinaryProtocolT; 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::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::readI32_virt (int32_t&) [with Protocol_ = apache::thrift::protocol::TBinaryProtocolT; 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)
The above is all the contents of the article "sample Analysis of C++ dynamic Library compilation in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.