Open noglass opened 6 years ago
I'm not at home, where my computer is, so I can't confirm that this works but I think changing
return [timer]() { timer->cancel(); };
to
return Timer([timer]() { timer->cancel(); });
may fix the could not convert lambda
. The others, I'll need wait til I'm at my computer to do some testing.
Thanks for the fast reply!
With that change, I was able to compile the example with the following command:
nigel@dontdeleteme:~/Documents/SleepyDiscord/sleepy-discord/examples/hello$ g++ -std=c++11 -I ../../include -I ../../include/sleepy_discord -I ../../deps -I ../../deps/include -I ../../include/sleepy_discord/IncludeNonexistant -L../../buildtools -L/usr/lib -pthread -lcurl -lssl -lcrypto ../../deps/cpr/cpr/*.cpp ../../sleepy_discord/*.cpp ../../sleepy_discord/*.c example0.cpp -o example.out
nigel@dontdeleteme:~/Documents/SleepyDiscord/sleepy-discord/examples/hello$
It also appears that CPR may not be properly installed in the setup.
Without manually compiling each file every time, I still get various linking errors. I even tried adding the compiled .o files instead of recompiling each one, but to no avail:
nigel@dontdeleteme:~/Documents/SleepyDiscord/sleepy-discord/examples/hello$ g++ -std=c++11 -I ../../include -I ../../include/sleepy_discord -I ../../deps -I ../../deps/include -I ../../include/sleepy_discord/IncludeNonexistant -L../../buildtools -L/usr/lib -pthread -lcurl -lssl -lcrypto ../../deps/cpr/cpr/*.cpp ../../buildtools/*.o example0.cpp -o example.out../../buildtools/client.o: In function `SleepyDiscord::CustomSession::CustomSession()':
client.cpp:(.text._ZN13SleepyDiscord13CustomSessionC2Ev[_ZN13SleepyDiscord13CustomSessionC5Ev]+0x29): undefined reference to `SleepyDiscord::CustomSession::init'
/tmp/ccgWSBgX.o: In function `main':
example0.cpp:(.text+0x10ef): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::run()'
/tmp/ccgWSBgX.o: In function `myClientClass::myClientClass(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char)':
example0.cpp:(.text._ZN13myClientClassC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc[_ZN13myClientClassC5ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc]+0x41): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::WebsocketppDiscordClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char)'
/tmp/ccgWSBgX.o: In function `myClientClass::~myClientClass()':
example0.cpp:(.text._ZN13myClientClassD2Ev[_ZN13myClientClassD5Ev]+0x22): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::~WebsocketppDiscordClient()'
/tmp/ccgWSBgX.o:(.data.rel.ro._ZTV13myClientClass[_ZTV13myClientClass]+0x10): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::run()'
/tmp/ccgWSBgX.o:(.data.rel.ro._ZTV13myClientClass[_ZTV13myClientClass]+0x18): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::schedule(std::function<void ()>, long)'
/tmp/ccgWSBgX.o:(.data.rel.ro._ZTV13myClientClass[_ZTV13myClientClass]+0x1b0): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::sleep(unsigned int)'
/tmp/ccgWSBgX.o:(.data.rel.ro._ZTV13myClientClass[_ZTV13myClientClass]+0x1c8): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::onError(SleepyDiscord::ErrorCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/ccgWSBgX.o:(.data.rel.ro._ZTV13myClientClass[_ZTV13myClientClass]+0x1d0): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccgWSBgX.o:(.data.rel.ro._ZTV13myClientClass[_ZTV13myClientClass]+0x1d8): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::send(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/ccgWSBgX.o:(.data.rel.ro._ZTV13myClientClass[_ZTV13myClientClass]+0x1e0): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::disconnect(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/ccgWSBgX.o:(.data.rel.ro._ZTV13myClientClass[_ZTV13myClientClass]+0x1e8): undefined reference to `SleepyDiscord::WebsocketppDiscordClient::runAsync()'
/tmp/ccgWSBgX.o:(.data.rel.ro._ZTI13myClientClass[_ZTI13myClientClass]+0x10): undefined reference to `typeinfo for SleepyDiscord::WebsocketppDiscordClient'
collect2: error: ld returned 1 exit status
This is with a newly compiled setup after making the Timer change.
After installing all needed libraries and packages and successfully compiling sleepy_discord, when compiling the hello example, I get linking errors with libsleepy_discord:
I am on
Debian 9.4.0
withg++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
You may also want to add
-pthread
to the tutorial as it is needed on linux.Further notes, just incase, I also tried to compile sleepy_discord with
-pthread
, but I don't believe it is necessary as it compiles either way. Same end result with and without it.Also, I ran the
setup.py
with options1
and0 1
, everything was successful.Initially, when trying to compile, I ran into the issue with openssl where
SSL_R_SHORT_READ
is undefined, I fixed this by applying this patch: https://github.com/LocutusOfBorg/websocketpp/commit/1dd07113f2a7489444a8990a95be42e035f8e9dfAfter applying the patch and successfully making, the file
./buildtools/libsleepy_discord.a
exists and is seemingly found by the linker.Upon further investigation, I found this:
Note: Because I did not install uwebsockets, I renamed
./sleepy_discord/uwebsockets_websocket.cpp
so thatg++
would not include it.However, when running
make -f Makefile.linux
;./buildtools/websocketpp_websocket.o
is created..