I have a boost socket implementation and it works perfectly on Windows & Linux, but on mac the same code gets a bunch of compilation errors such as.
src/modules/socket/ssl_tcp_socket_binding.cpp: In constructor
'ti::SecureTCPSocket::SecureTCPSocket(tide::Host*, ti::TCPSocketBinding*)':
src/modules/socket/ssl_tcp_socket_binding.cpp:27: error: class 'ti::SecureTCPSocket' does not have any field named 'Socket'
src/modules/socket/ssl_tcp_socket_binding.cpp:29: error: no matching function for call to 'ti::Socket<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >&> >::Socket()'
Constructor
SecureTCPSocket::SecureTCPSocket(Host *host, TCPSocketBinding * tcp_socket_binding)
: Socket(host, string("Socket.SecureTCPSocket")),
Header
class SecureTCPSocket
: public Socket<boost::asio::ssl::stream<tcp::socket&> >
{
I don't understand why this is an issue on Mac's but perfectly fine on Linux & Windows?
Any idea as to what I may be doing wrong or missing?
When you mentioning a class template different than the one you are currently implementing, you have to specify the template arguments. Unless it is a copy&paste error, you need to use
SecureTCPSocket::SecureTCPSocket(Host *host, TCPSocketBinding * tcp_socket_binding)
: Socket<boost::asio::ssl::stream<tcp::socket&> >(host,
string("Socket.SecureTCPSocket")),
...
In fact, the error message indicates that need: it states that it doesn't know what Socket
is and continues to state that there is no matching constructor for the instantiation Socket<boost::asio::ssl::stream<tcp::socket&> >
(well, a more expanded version thereof).
The question in this case actually isn't why the compiler used on Mac (clang?) doesn't compile the code but rather why the compilers used on Windows and Linux do compile the code!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.