-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error compiling sio_client_impl.cpp #300
Comments
@GIP2000 i get same issue |
I have been encountering the same issue . Has anyone resolved the errors ? |
I have the same issue boost is still "required" even though it should not be and I eliminated most of the errors by including boost to the project and have it down to for errors |
Hi, as of af68bf3 Boost is no longer required. We've updated the installation instructions without CMake. Can you try following them and see if the issue persists? |
When you say without CMake, I have inferred that you mean Visual Studio, but which version? For the sake of user friendliness say at least Visual Studio. There are also other C++ IDEs. Thanks! |
Hi @jimver04. We don't mean any IDE in particular. Each IDE or build system has a way of specifying a header search path (point 2) a source files path (point 3) and some defines (point 4). So in your IDE or build system you need to specify:
Afterwards you can use the socket io c++ library by including the header |
I have done these steps and I get:
boost.lib is nowhere in my filesystem |
Boost is not required. We only officially support CMake and provide info for other build systems. I don't know how to help you if you are not using CMake |
Ah you are right! We forgot to remove that part from the examples. I'll remove it from the documentation |
I am trying to compile the project however I run into an issue when I compile the sio_clinet_impl.cpp file
Makefile
`.PHONY: clean
all: SocketHandler.out
SocketHandler.out:
g++ -std=c++11 -I ./socket.io-client-cpp/lib/asio/asio/include -I ./socket.io-client-cpp/lib/websocketpp -I ./socket.io-client-cpp/lib/rapidjson/include -c SocketHandler.cpp
g++ -std=c++11 -I ./socket.io-client-cpp/lib/asio/asio/include -I ./socket.io-client-cpp/lib/websocketpp -I ./socket.io-client-cpp/lib/rapidjson/include -c sio_client.cpp
g++ -std=c++11 -I ./socket.io-client-cpp/lib/asio/asio/include -I ./socket.io-client-cpp/lib/websocketpp -I ./socket.io-client-cpp/lib/rapidjson/include -c sio_socket.cpp
g++ -std=c++11 -I ./socket.io-client-cpp/lib/asio/asio/include -I ./socket.io-client-cpp/lib/websocketpp -I ./socket.io-client-cpp/lib/rapidjson/include -c internal/sio_packet.cpp
g++ -std=c++11 -I ./socket.io-client-cpp/lib/asio/asio/include -I ./socket.io-client-cpp/lib/websocketpp -I ./socket.io-client-cpp/lib/rapidjson/include -c internal/sio_client_impl.cpp
g++ -std=c++11 sio_client.o sio_socket.o sio_packet.o SocketHandler.o -o output.out
clean:
rm -rf SocketHandler.out
rm -rf sio_client.o
rm -rf sio_socket.o
rm -rf sio_packet.o
rm -rf SocketHandler.o`
my boost version is 1.71.0ubuntu2 (I ran dpkg -s libboost-dev | grep 'Version')
I moved the contents of the src folder to the main directory but left everything else in the folder that comes with the git clone.
I am clearly doing something wrong can anyone help me please.
I get these errors:
`
internal/sio_client_impl.cpp: In member function ‘asio::io_service& sio::client_impl::get_io_service()’:
internal/sio_client_impl.cpp:201:39: error: invalid initialization of reference of type ‘asio::io_service&’ {aka ‘asio::io_context&’} from expression of type ‘boost::asio::io_service’ {aka ‘boost::asio::io_context’}
201 | return m_client.get_io_service();
| ~~~~~~~~~~~~~~~~~~~~~~~^~
internal/sio_client_impl.cpp: In member function ‘void sio::client_impl::ping(const error_code&)’:
internal/sio_client_impl.cpp:321:88: error: no matching function for call to ‘asio::basic_waitable_timerstd::chrono::_V2::steady_clock::basic_waitable_timer(boost::asio::io_service&)’
321 | _timer.reset(new asio::steady_timer(m_client.get_io_service()));
| ^
In file included from ./socket.io-client-cpp/lib/asio/asio/include/asio/steady_timer.hpp:22,
from internal/sio_client_impl.h:37,
from internal/sio_client_impl.cpp:9:
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:231:3: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::basic_waitable_timer<Clock, WaitTraits>&&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock]’
231 | basic_waitable_timer(basic_waitable_timer&& other)
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:231:47: note: no known conversion for argument 1 from ‘boost::asio::io_service’ {aka ‘boost::asio::io_context’} to ‘asio::basic_waitable_timerstd::chrono::_V2::steady_clock&&’
231 | basic_waitable_timer(basic_waitable_timer&& other)
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:210:3: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::io_context&, const duration&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock; asio::basic_waitable_timer<Clock, WaitTraits>::duration = std::chrono::duration<long int, std::ratio<1, 1000000000> >]’
210 | basic_waitable_timer(asio::io_context& io_context,
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:210:3: note: candidate expects 2 arguments, 1 provided
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:191:3: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::io_context&, const time_point&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock; asio::basic_waitable_timer<Clock, WaitTraits>::time_point = std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >]’
191 | basic_waitable_timer(asio::io_context& io_context,
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:191:3: note: candidate expects 2 arguments, 1 provided
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:176:12: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::io_context&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock]’
176 | explicit basic_waitable_timer(asio::io_context& io_context)
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:176:51: note: no known conversion for argument 1 from ‘boost::asio::io_service’ {aka ‘boost::asio::io_context’} to ‘asio::io_context&’
176 | explicit basic_waitable_timer(asio::io_context& io_context)
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
internal/sio_client_impl.cpp: In member function ‘void sio::client_impl::on_fail(websocketpp::connection_hdl)’:
internal/sio_client_impl.cpp:405:82: error: no matching function for call to ‘asio::basic_waitable_timerstd::chrono::_V2::steady_clock::basic_waitable_timer(boost::asio::io_service&)’
405 | _timer.reset(new asio::steady_timer(m_client.get_io_service()));
| ^
In file included from ./socket.io-client-cpp/lib/asio/asio/include/asio/steady_timer.hpp:22,
from internal/sio_client_impl.h:37,
from internal/sio_client_impl.cpp:9:
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:231:3: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::basic_waitable_timer<Clock, WaitTraits>&&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock]’
231 | basic_waitable_timer(basic_waitable_timer&& other)
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:231:47: note: no known conversion for argument 1 from ‘boost::asio::io_service’ {aka ‘boost::asio::io_context’} to ‘asio::basic_waitable_timerstd::chrono::_V2::steady_clock&&’
231 | basic_waitable_timer(basic_waitable_timer&& other)
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:210:3: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::io_context&, const duration&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock; asio::basic_waitable_timer<Clock, WaitTraits>::duration = std::chrono::duration<long int, std::ratio<1, 1000000000> >]’
210 | basic_waitable_timer(asio::io_context& io_context,
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:210:3: note: candidate expects 2 arguments, 1 provided
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:191:3: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::io_context&, const time_point&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock; asio::basic_waitable_timer<Clock, WaitTraits>::time_point = std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >]’
191 | basic_waitable_timer(asio::io_context& io_context,
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:191:3: note: candidate expects 2 arguments, 1 provided
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:176:12: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::io_context&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock]’
176 | explicit basic_waitable_timer(asio::io_context& io_context)
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:176:51: note: no known conversion for argument 1 from ‘boost::asio::io_service’ {aka ‘boost::asio::io_context’} to ‘asio::io_context&’
176 | explicit basic_waitable_timer(asio::io_context& io_context)
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
internal/sio_client_impl.cpp: In member function ‘void sio::client_impl::on_close(websocketpp::connection_hdl)’:
internal/sio_client_impl.cpp:469:86: error: no matching function for call to ‘asio::basic_waitable_timerstd::chrono::_V2::steady_clock::basic_waitable_timer(boost::asio::io_service&)’
469 | _timer.reset(new asio::steady_timer(m_client.get_io_service()));
| ^
In file included from ./socket.io-client-cpp/lib/asio/asio/include/asio/steady_timer.hpp:22,
from internal/sio_client_impl.h:37,
from internal/sio_client_impl.cpp:9:
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:231:3: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::basic_waitable_timer<Clock, WaitTraits>&&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock]’
231 | basic_waitable_timer(basic_waitable_timer&& other)
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:231:47: note: no known conversion for argument 1 from ‘boost::asio::io_service’ {aka ‘boost::asio::io_context’} to ‘asio::basic_waitable_timerstd::chrono::_V2::steady_clock&&’
231 | basic_waitable_timer(basic_waitable_timer&& other)
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:210:3: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::io_context&, const duration&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock; asio::basic_waitable_timer<Clock, WaitTraits>::duration = std::chrono::duration<long int, std::ratio<1, 1000000000> >]’
210 | basic_waitable_timer(asio::io_context& io_context,
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:210:3: note: candidate expects 2 arguments, 1 provided
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:191:3: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::io_context&, const time_point&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock; asio::basic_waitable_timer<Clock, WaitTraits>::time_point = std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >]’
191 | basic_waitable_timer(asio::io_context& io_context,
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:191:3: note: candidate expects 2 arguments, 1 provided
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:176:12: note: candidate: ‘asio::basic_waitable_timer<Clock, WaitTraits>::basic_waitable_timer(asio::io_context&) [with Clock = std::chrono::_V2::steady_clock; WaitTraits = asio::wait_traitsstd::chrono::_V2::steady_clock]’
176 | explicit basic_waitable_timer(asio::io_context& io_context)
| ^~~~~~~~~~~~~~~~~~~~
./socket.io-client-cpp/lib/asio/asio/include/asio/basic_waitable_timer.hpp:176:51: note: no known conversion for argument 1 from ‘boost::asio::io_service’ {aka ‘boost::asio::io_context’} to ‘asio::io_context&’
176 | explicit basic_waitable_timer(asio::io_context& io_context)`
The text was updated successfully, but these errors were encountered: