OTHire icon indicating copy to clipboard operation
OTHire copied to clipboard

no matching function for call to ‘boost::posix_time::seconds::seconds(Connection::<unnamed enum>)’

Open serverok opened this issue 3 years ago • 2 comments

When compiling on Debian 10, I am getting the following error

root@sok-game:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster
root@sok-game:~# dpkg -l | grep libboost-all-dev
ii  libboost-all-dev                       1.67.0.1                     amd64        Boost C++ Libraries development files (ALL) (default version)
root@sok-game:~/OTHire/source# make
make  all-am
make[1]: Entering directory '/root/OTHire/source'
g++ -DHAVE_CONFIG_H -I.    -I/usr/include/libxml2  -I/usr/include/lua5.1  -D__USE_MYSQL__     -D__ENABLE_SERVER_DIAGNOSTIC__ -std=c++11 -DSYSCONFDIR=\"/usr/local/etc\" -DPKGDATADIR=\"/usr/local/share/otserv\" -D_THREAD_SAFE -D__OLD_GUILD_SYSTEM__ -D_REENTRANT -Wall -g -O2 -MT connection.o -MD -MP -MF .deps/connection.Tpo -c -o connection.o connection.cpp
connection.cpp: In member function ‘void Connection::acceptConnection()’:
connection.cpp:255:83: error: no matching function for call to ‘boost::posix_time::seconds::seconds(Connection::<unnamed enum>)’
   m_readTimer.expires_from_now(boost::posix_time::seconds(Connection::read_timeout));
                                                                                   ^
In file included from /usr/include/boost/date_time/posix_time/posix_time_types.hpp:16,
                 from /usr/include/boost/asio/time_traits.hpp:23,
                 from /usr/include/boost/asio/basic_deadline_timer.hpp:28,
                 from /usr/include/boost/asio.hpp:24,
                 from connection.h:25,
                 from connection.cpp:22:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: note: candidate: ‘template<class T> boost::posix_time::seconds::seconds(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*)’
       explicit seconds(T const& s,
                ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: note:   template argument deduction/substitution failed:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp: In substitution of ‘template<class T> boost::posix_time::seconds::seconds(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*) [with T = Connection::<unnamed enum>]’:
connection.cpp:255:83:   required from here
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: error: no type named ‘type’ in ‘struct boost::enable_if<boost::is_integral<Connection::<unnamed enum> >, void>’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note: candidate: ‘boost::posix_time::seconds::seconds(const boost::posix_time::seconds&)’
   class BOOST_SYMBOL_VISIBLE seconds : public time_duration
                              ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note:   no known conversion for argument 1 from ‘Connection::<unnamed enum>’ to ‘const boost::posix_time::seconds&’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note: candidate: ‘boost::posix_time::seconds::seconds(boost::posix_time::seconds&&)’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note:   no known conversion for argument 1 from ‘Connection::<unnamed enum>’ to ‘boost::posix_time::seconds&&’
connection.cpp: In member function ‘void Connection::parseHeader(const boost::system::error_code&)’:
connection.cpp:307:83: error: no matching function for call to ‘boost::posix_time::seconds::seconds(Connection::<unnamed enum>)’
   m_readTimer.expires_from_now(boost::posix_time::seconds(Connection::read_timeout));
                                                                                   ^
In file included from /usr/include/boost/date_time/posix_time/posix_time_types.hpp:16,
                 from /usr/include/boost/asio/time_traits.hpp:23,
                 from /usr/include/boost/asio/basic_deadline_timer.hpp:28,
                 from /usr/include/boost/asio.hpp:24,
                 from connection.h:25,
                 from connection.cpp:22:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: note: candidate: ‘template<class T> boost::posix_time::seconds::seconds(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*)’
       explicit seconds(T const& s,
                ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: note:   template argument deduction/substitution failed:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp: In substitution of ‘template<class T> boost::posix_time::seconds::seconds(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*) [with T = Connection::<unnamed enum>]’:
connection.cpp:307:83:   required from here
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: error: no type named ‘type’ in ‘struct boost::enable_if<boost::is_integral<Connection::<unnamed enum> >, void>’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note: candidate: ‘boost::posix_time::seconds::seconds(const boost::posix_time::seconds&)’
   class BOOST_SYMBOL_VISIBLE seconds : public time_duration
                              ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note:   no known conversion for argument 1 from ‘Connection::<unnamed enum>’ to ‘const boost::posix_time::seconds&’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note: candidate: ‘boost::posix_time::seconds::seconds(boost::posix_time::seconds&&)’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note:   no known conversion for argument 1 from ‘Connection::<unnamed enum>’ to ‘boost::posix_time::seconds&&’
connection.cpp: In member function ‘void Connection::parsePacket(const boost::system::error_code&)’:
connection.cpp:369:83: error: no matching function for call to ‘boost::posix_time::seconds::seconds(Connection::<unnamed enum>)’
   m_readTimer.expires_from_now(boost::posix_time::seconds(Connection::read_timeout));
                                                                                   ^
In file included from /usr/include/boost/date_time/posix_time/posix_time_types.hpp:16,
                 from /usr/include/boost/asio/time_traits.hpp:23,
                 from /usr/include/boost/asio/basic_deadline_timer.hpp:28,
                 from /usr/include/boost/asio.hpp:24,
                 from connection.h:25,
                 from connection.cpp:22:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: note: candidate: ‘template<class T> boost::posix_time::seconds::seconds(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*)’
       explicit seconds(T const& s,
                ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: note:   template argument deduction/substitution failed:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp: In substitution of ‘template<class T> boost::posix_time::seconds::seconds(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*) [with T = Connection::<unnamed enum>]’:
connection.cpp:369:83:   required from here
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: error: no type named ‘type’ in ‘struct boost::enable_if<boost::is_integral<Connection::<unnamed enum> >, void>’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note: candidate: ‘boost::posix_time::seconds::seconds(const boost::posix_time::seconds&)’
   class BOOST_SYMBOL_VISIBLE seconds : public time_duration
                              ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note:   no known conversion for argument 1 from ‘Connection::<unnamed enum>’ to ‘const boost::posix_time::seconds&’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note: candidate: ‘boost::posix_time::seconds::seconds(boost::posix_time::seconds&&)’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note:   no known conversion for argument 1 from ‘Connection::<unnamed enum>’ to ‘boost::posix_time::seconds&&’
connection.cpp: In member function ‘void Connection::internalSend(OutputMessage_ptr)’:
connection.cpp:432:85: error: no matching function for call to ‘boost::posix_time::seconds::seconds(Connection::<unnamed enum>)’
   m_writeTimer.expires_from_now(boost::posix_time::seconds(Connection::write_timeout));
                                                                                     ^
In file included from /usr/include/boost/date_time/posix_time/posix_time_types.hpp:16,
                 from /usr/include/boost/asio/time_traits.hpp:23,
                 from /usr/include/boost/asio/basic_deadline_timer.hpp:28,
                 from /usr/include/boost/asio.hpp:24,
                 from connection.h:25,
                 from connection.cpp:22:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: note: candidate: ‘template<class T> boost::posix_time::seconds::seconds(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*)’
       explicit seconds(T const& s,
                ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: note:   template argument deduction/substitution failed:
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp: In substitution of ‘template<class T> boost::posix_time::seconds::seconds(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*) [with T = Connection::<unnamed enum>]’:
connection.cpp:432:85:   required from here
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:57:16: error: no type named ‘type’ in ‘struct boost::enable_if<boost::is_integral<Connection::<unnamed enum> >, void>’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note: candidate: ‘boost::posix_time::seconds::seconds(const boost::posix_time::seconds&)’
   class BOOST_SYMBOL_VISIBLE seconds : public time_duration
                              ^~~~~~~
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note:   no known conversion for argument 1 from ‘Connection::<unnamed enum>’ to ‘const boost::posix_time::seconds&’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note: candidate: ‘boost::posix_time::seconds::seconds(boost::posix_time::seconds&&)’
/usr/include/boost/date_time/posix_time/posix_time_duration.hpp:53:30: note:   no known conversion for argument 1 from ‘Connection::<unnamed enum>’ to ‘boost::posix_time::seconds&&’
make[1]: *** [Makefile:663: connection.o] Error 1
make[1]: Leaving directory '/root/OTHire/source'
make: *** [Makefile:479: all] Error 2
root@sok-game:~/OTHire/source# 

Does anyone know how to fix this error?

serverok avatar Aug 23 '22 20:08 serverok

Most modern version of Debian I was able to compile OTHire on was Debian 9 "Stretch"

If you follow the guide from the wiki https://github.com/Ezzz-dev/OTHire/wiki/Compiling-on-Debian-7-Wheezy but do the same for Debian 9 it should work.

jooleer avatar Aug 27 '22 19:08 jooleer

To make it work on Debian 10, modify

source/connection.cpp

Find

Connection::read_timeout

Replace with 30

Find

Connection::write_timeout

Replace with 30

Now make command will work.

serverok avatar Aug 27 '22 21:08 serverok

Thanks for the wiki guide.

https://github.com/Ezzz-dev/OTHire/wiki/Compiling-on-Debian-10-buster

peonso avatar Sep 13 '22 20:09 peonso