yourWaifu / sleepy-discord

C++ library for the Discord chat client. Please use Rust for new bots
https://yourWaifu.github.io/sleepy-discord/
MIT License
707 stars 95 forks source link

Linux Project Linking Errors #95

Closed TylerTheFox closed 6 years ago

TylerTheFox commented 6 years ago

I did a fresh clone from master and now I can't figure out how to link again. Tried with the original make file and that didn't produce any better results.

Also suggestion: Add the examples to the TravisCl automated build to test linking.

This is the code that requires linking to sleepy discord. https://github.com/Brandantl/Monero-TipBot/blob/develop/src/Discord.h https://github.com/Brandantl/Monero-TipBot/blob/develop/src/Discord.cpp

Here is my build commands.

g++ -Wall -c -std=c++11 -fPIC ../sleepy_discord/.cpp ../sleepy_discord/.c ../deps/cpr/cpr/.cpp -I ../include/sleepy_discord -I ../deps/include -I ../include/sleepy_discord/IncludeNonexistent ar rv libsleepy_discord.a .o mv libsleepy_discord.a ~/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a

Output of the ar command

vm@vm:~/sleepy-discord/buildtools$ ar rv sleepy_discord.a *.o ar: creating sleepy_discord.a a - asignments_client.o a - attachment.o a - auth.o a - channel.o a - client.o a - cookies.o a - cpr_session.o a - cprtypes.o a - default_functions.o a - digest.o a - discord_object_interface.o a - embed.o a - endpoints.o a - error.o a - experimental.o a - gateway.o a - http.o a - invite.o a - json.o a - json_wrapper.o a - message.o a - multipart.o a - parameters.o a - payload.o a - permissions.o a - proxies.o a - sd_error.o a - server.o a - session.o a - ssl_options.o a - timeout.o a - user.o a - util.o a - uwebsockets_websocket.o a - voice.o a - webhook.o a - websocketpp_websocket.o

Linker messages from the project:

[ 87%] Linking CXX executable TIPBOT CMakeFiles/TIPBOT.dir/src/main.cpp.o: In function _ZN7DiscordCI2N13SleepyDiscord26WebsocketppWebsocketClientEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc': /home/vm/Monero-TipBot/src/Discord.h:20: undefined reference toSleepyDiscord::WebsocketppWebsocketClient::WebsocketppWebsocketClient(std::cxx11::basic_string<char, std::char_traits, std::allocator >, char)' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x88): undefined reference to SleepyDiscord::WebsocketppWebsocketClient::run()' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x90): undefined reference toSleepyDiscord::WebsocketppWebsocketClient::schedule(std::function<void ()>, long)' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x148): undefined reference to SleepyDiscord::BaseDiscordClient::onEditVoiceState(SleepyDiscord::VoiceState)' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x170): undefined reference toSleepyDiscord::BaseDiscordClient::onEditVoiceServer(SleepyDiscord::Snowflake)' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x230): undefined reference to SleepyDiscord::WebsocketppWebsocketClient::sleep(unsigned int)' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x248): undefined reference toSleepyDiscord::WebsocketppWebsocketClient::onError(SleepyDiscord::ErrorCode, std::cxx11::basic_string<char, std::char_traits, std::allocator >)' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x250): undefined reference to SleepyDiscord::WebsocketppWebsocketClient::connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, SleepyDiscord::GenericMessageReceiver*, std::weak_ptr<void>*)' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x258): undefined reference toSleepyDiscord::WebsocketppWebsocketClient::send(std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::weak_ptr)' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x260): undefined reference to `SleepyDiscord::WebsocketppWebsocketClient::disconnect(unsigned int, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::weak_ptr)' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTV7Discord[_ZTV7Discord]+0x268): undefined reference to SleepyDiscord::WebsocketppWebsocketClient::runAsync()' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o: In functionDiscord::~Discord()': /home/vm/Monero-TipBot/src/Discord.h:18: undefined reference to SleepyDiscord::WebsocketppWebsocketClient::~WebsocketppWebsocketClient()' CMakeFiles/TIPBOT.dir/src/Discord.cpp.o:(.rodata._ZTI7Discord[_ZTI7Discord]+0x28): undefined reference totypeinfo for SleepyDiscord::WebsocketppWebsocketClient' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(client.o): In function `SleepyDiscord::CPRSession::setUrl(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)': client.cpp:(.text._ZN13SleepyDiscord10CPRSession6setUrlERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN13SleepyDiscord10CPRSession6setUrlERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x46): undefined reference to `cpr::Session::SetUrl(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(client.o): In function SleepyDiscord::CPRSession::setBody(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*)': client.cpp:(.text._ZN13SleepyDiscord10CPRSession7setBodyEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN13SleepyDiscord10CPRSession7setBodyEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x46): undefined reference tocpr::Session::SetBody(cpr::Body&&)' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(client.o): In function SleepyDiscord::CPRSession::Post()': client.cpp:(.text._ZN13SleepyDiscord10CPRSession4PostEv[_ZN13SleepyDiscord10CPRSession4PostEv]+0x42): undefined reference tocpr::Session::Post()' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(client.o): In function SleepyDiscord::CPRSession::Patch()': client.cpp:(.text._ZN13SleepyDiscord10CPRSession5PatchEv[_ZN13SleepyDiscord10CPRSession5PatchEv]+0x42): undefined reference tocpr::Session::Patch()' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(client.o): In function SleepyDiscord::CPRSession::Delete()': client.cpp:(.text._ZN13SleepyDiscord10CPRSession6DeleteEv[_ZN13SleepyDiscord10CPRSession6DeleteEv]+0x42): undefined reference tocpr::Session::Delete()' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(client.o): In function SleepyDiscord::CPRSession::Get()': client.cpp:(.text._ZN13SleepyDiscord10CPRSession3GetEv[_ZN13SleepyDiscord10CPRSession3GetEv]+0x42): undefined reference tocpr::Session::Get()' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(client.o): In function SleepyDiscord::CPRSession::Put()': client.cpp:(.text._ZN13SleepyDiscord10CPRSession3PutEv[_ZN13SleepyDiscord10CPRSession3PutEv]+0x42): undefined reference tocpr::Session::Put()' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(client.o): In function SleepyDiscord::CPRSession::CPRSession()': client.cpp:(.text._ZN13SleepyDiscord10CPRSessionC2Ev[_ZN13SleepyDiscord10CPRSessionC5Ev]+0x42): undefined reference tocpr::Session::Session()' client.cpp:(.text._ZN13SleepyDiscord10CPRSessionC2Ev[_ZN13SleepyDiscord10CPRSessionC5Ev]+0x69): undefined reference to cpr::Multipart::Multipart(std::initializer_list<cpr::Part> const&)' client.cpp:(.text._ZN13SleepyDiscord10CPRSessionC2Ev[_ZN13SleepyDiscord10CPRSessionC5Ev]+0xc7): undefined reference tocpr::Session::~Session()' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(client.o): In function SleepyDiscord::CPRSession::~CPRSession()': client.cpp:(.text._ZN13SleepyDiscord10CPRSessionD2Ev[_ZN13SleepyDiscord10CPRSessionD5Ev]+0x34): undefined reference tocpr::Session::~Session()' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(cpr_session.o): In function SleepyDiscord::CPRSession::setHeader(std::vector<SleepyDiscord::HeaderPair, std::allocator<SleepyDiscord::HeaderPair> > const&)': cpr_session.cpp:(.text+0x136): undefined reference tocpr::Session::SetHeader(std::map<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::cxx11::basic_string<char, std::char_traits, std::allocator >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > > const&)' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(cpr_session.o): In function SleepyDiscord::CPRSession::setMultipart(std::initializer_list<SleepyDiscord::Part> const&)': cpr_session.cpp:(.text+0x3bc): undefined reference tocpr::Session::SetMultipart(cpr::Multipart const&)' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(cpr_session.o): In function std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': cpr_session.cpp:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE24_M_get_insert_unique_posERS7_[_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE24_M_get_insert_unique_posERS7_]+0x72): undefined reference tocpr::CaseInsensitiveCompare::operator()(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) const' cpr_session.cpp:(.text._ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE24_M_get_insert_uniqueposERS7[_ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE24_M_get_insert_uniqueposERS7]+0x12a): undefined reference to cpr::CaseInsensitiveCompare::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' /home/vm/Monero-TipBot/extern/sleepy-discord/lib/linux/libsleepy_discord.a(cpr_session.o): In functionstd::_Rb_tree_iterator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > std::_Rb_tree<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::_Select1st<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > >::_Minsert<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > const&, std::_Rb_tree<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::_Select1st<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > >::_Alloc_node>(std::_Rb_tree_node_base, std::_Rb_tree_node_base, std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > const&, std::_Rb_tree<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::_Select1st<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > >, cpr::CaseInsensitiveCompare, std::allocator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > >::_Alloc_node&)': cpr_session.cpp:(.text._ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE10_M_insert_IRKS8_NSE_11_Alloc_nodeEEESt17_Rb_tree_iteratorIS8_EPSt18_Rb_tree_node_baseSM_OTRT0[_ZNSt8_Rb_treeINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_EN3cpr22CaseInsensitiveCompareESaIS8_EE10_M_insert_IRKS8_NSE_11_Alloc_nodeEEESt17_Rb_tree_iteratorIS8_EPSt18_Rb_tree_node_baseSM_OTRT0]+0x84): undefined reference to `cpr::CaseInsensitiveCompare::operator()(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) const' collect2: error: ld returned 1 exit status CMakeFiles/TIPBOT.dir/build.make:458: recipe for target 'TIPBOT' failed make[2]: [TIPBOT] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/TIPBOT.dir/all' failed make[1]: [CMakeFiles/TIPBOT.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

yourWaifu commented 6 years ago

It looks like you don't have websocketpp in your includes or deps and that you didn't link cpr. To fix this, I think you need to download websocketpp and it's dependencies (the setup script should help with that), include cpr and compile it and link it with -lcpr.

TylerTheFox commented 6 years ago

Thats included in the compile command

g++ -Wall -c -std=c++11 -fPIC ../sleepy_discord/.cpp ../sleepy_discord/.c *../deps/cpr/cpr/.cpp** -I ../include/sleepy_discord -I ../deps/include -I ../include/sleepy_discord/IncludeNonexistent

you can even see the CPR .o files in the ar command auth.o error.o cookies.o etc.

TylerTheFox commented 6 years ago

Turns out I didn't copy the new headers. Heres the compiler error I get now with the headers copied. Has anything changed with those functions?

Example of the errors is because of this vector() call https://github.com/Brandantl/Monero-TipBot/blob/develop/src/Discord.cpp#L220

[ 31%] Building CXX object CMakeFiles/TIPBOT.dir/src/Discord.cpp.o /home/vm/Monero-TipBot/src/Discord.cpp: In member function ‘UserMessage Discord::ConvertSleepyDiscordMsg(const SleepyDiscord::Message&)’: /home/vm/Monero-TipBot/src/Discord.cpp:148:28: error: ambiguous overload for ‘operator=’ (operand types are ‘std::cxx11::string {aka std::cxx11::basic_string}’ and ‘const SleepyDiscord::Snowflake’) UsrMsg.User.id_str = message.author.ID; ^ In file included from /usr/include/c++/5/string:52:0, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/Bugcheck.h:22, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/Foundation.h:163, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/NumberParser.h:21, from /home/vm/Monero-TipBot/src/Tipbot.h:15, from /home/vm/Monero-TipBot/src/Discord.h:15, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /usr/include/c++/5/bits/basic_string.h:566:7: note: candidate: std::cxx11::basic_string<_CharT, _Traits, _Alloc>& std::cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator] operator=(const basic_string& __str) ^ /usr/include/c++/5/bits/basic_string.h:566:7: note: conversion of argument 1 would be ill-formed: /home/vm/Monero-TipBot/src/Discord.cpp:148:45: error: invalid user-defined conversion from ‘const SleepyDiscord::Snowflake’ to ‘const std::cxx11::basic_string&’ [-fpermissive] UsrMsg.User.id_str = message.author.ID; ^ In file included from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/user.h:4:0, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/message.h:2, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:13, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/websocketpp_websocket.h:15, from /home/vm/Monero-TipBot/src/Discord.h:16, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: candidate is: SleepyDiscord::Snowflake::operator const string&() [with DiscordObject = SleepyDiscord::User; std::cxx11::string = std::cxx11::basic_string] operator const std::string&() { return raw; } ^ /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: passing ‘const SleepyDiscord::Snowflake’ as ‘this’ argument discards qualifiers /home/vm/Monero-TipBot/src/Discord.cpp:148:28: error: passing ‘const SleepyDiscord::Snowflake’ as ‘this’ argument discards qualifiers [-fpermissive] UsrMsg.User.id_str = message.author.ID; ^ In file included from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/user.h:4:0, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/message.h:2, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:13, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/websocketpp_websocket.h:15, from /home/vm/Monero-TipBot/src/Discord.h:16, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: in call to ‘SleepyDiscord::Snowflake::operator const string&() [with DiscordObject = SleepyDiscord::User; std::cxx11::string = std::cxx11::basic_string]’ operator const std::string&() { return raw; } ^ In file included from /usr/include/c++/5/string:52:0, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/Bugcheck.h:22, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/Foundation.h:163, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/NumberParser.h:21, from /home/vm/Monero-TipBot/src/Tipbot.h:15, from /home/vm/Monero-TipBot/src/Discord.h:15, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /usr/include/c++/5/bits/basic_string.h:634:7: note: candidate: std::cxx11::basic_string<_CharT, _Traits, _Alloc>& std::cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator] operator=(basic_string&& __str) ^ /usr/include/c++/5/bits/basic_string.h:634:7: note: conversion of argument 1 would be ill-formed: /home/vm/Monero-TipBot/src/Discord.cpp:148:45: error: invalid user-defined conversion from ‘const SleepyDiscord::Snowflake’ to ‘std::cxx11::basic_string&&’ [-fpermissive] UsrMsg.User.id_str = message.author.ID; ^ In file included from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/user.h:4:0, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/message.h:2, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:13, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/websocketpp_websocket.h:15, from /home/vm/Monero-TipBot/src/Discord.h:16, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: candidate is: SleepyDiscord::Snowflake::operator const string&() [with DiscordObject = SleepyDiscord::User; std::cxx11::string = std::cxx11::basic_string] operator const std::string&() { return raw; } ^ /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: passing ‘const SleepyDiscord::Snowflake’ as ‘this’ argument discards qualifiers /home/vm/Monero-TipBot/src/Discord.cpp:148:28: error: passing ‘const SleepyDiscord::Snowflake’ as ‘this’ argument discards qualifiers [-fpermissive] UsrMsg.User.id_str = message.author.ID; ^ In file included from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/user.h:4:0, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/message.h:2, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:13, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/websocketpp_websocket.h:15, from /home/vm/Monero-TipBot/src/Discord.h:16, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: in call to ‘SleepyDiscord::Snowflake::operator const string&() [with DiscordObject = SleepyDiscord::User; std::cxx11::string = std::cxx11::basic_string]’ operator const std::string&() { return raw; } ^ /home/vm/Monero-TipBot/src/Discord.cpp:148:28: error: conversion from ‘const string {aka const std::cxx11::basic_string}’ to ‘std::cxx11::basic_string&&’ discards qualifiers [-fpermissive] UsrMsg.User.id_str = message.author.ID; ^ /home/vm/Monero-TipBot/src/Discord.cpp:152:31: error: ambiguous overload for ‘operator=’ (operand types are ‘std::cxx11::string {aka std::__cxx11::basic_string}’ and ‘const SleepyDiscord::Snowflake’) UsrMsg.Channel.id_str = message.channelID; ^ In file included from /usr/include/c++/5/string:52:0, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/Bugcheck.h:22, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/Foundation.h:163, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/NumberParser.h:21, from /home/vm/Monero-TipBot/src/Tipbot.h:15, from /home/vm/Monero-TipBot/src/Discord.h:15, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /usr/include/c++/5/bits/basic_string.h:566:7: note: candidate: std::cxx11::basic_string<_CharT, _Traits, _Alloc>& std::cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator] operator=(const basic_string& str) ^ /usr/include/c++/5/bits/basic_string.h:566:7: note: conversion of argument 1 would be ill-formed: /home/vm/Monero-TipBot/src/Discord.cpp:152:41: error: invalid user-defined conversion from ‘const SleepyDiscord::Snowflake’ to ‘const std::cxx11::basic_string&’ [-fpermissive] UsrMsg.Channel.id_str = message.channelID; ^ In file included from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/user.h:4:0, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/message.h:2, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:13, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/websocketpp_websocket.h:15, from /home/vm/Monero-TipBot/src/Discord.h:16, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: candidate is: SleepyDiscord::Snowflake::operator const string&() [with DiscordObject = SleepyDiscord::Channel; std::cxx11::string = std::__cxx11::basic_string] operator const std::string&() { return raw; } ^ /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: passing ‘const SleepyDiscord::Snowflake*’ as ‘this’ argument discards qualifiers /home/vm/Monero-TipBot/src/Discord.cpp:152:31: error: passing ‘const SleepyDiscord::Snowflake’ as ‘this’ argument discards qualifiers [-fpermissive] UsrMsg.Channel.id_str = message.channelID; ^ In file included from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/user.h:4:0, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/message.h:2, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:13, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/websocketpp_websocket.h:15, from /home/vm/Monero-TipBot/src/Discord.h:16, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: in call to ‘SleepyDiscord::Snowflake::operator const string&() [with DiscordObject = SleepyDiscord::Channel; std::cxx11::string = std::cxx11::basic_string]’ operator const std::string&() { return raw; } ^ In file included from /usr/include/c++/5/string:52:0, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/Bugcheck.h:22, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/Foundation.h:163, from /home/vm/Monero-TipBot/extern/poco-1.9.0/Foundation/include/Poco/NumberParser.h:21, from /home/vm/Monero-TipBot/src/Tipbot.h:15, from /home/vm/Monero-TipBot/src/Discord.h:15, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /usr/include/c++/5/bits/basic_string.h:634:7: note: candidate: std::cxx11::basic_string<_CharT, _Traits, _Alloc>& std::cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator] operator=(basic_string&& str) ^ /usr/include/c++/5/bits/basic_string.h:634:7: note: conversion of argument 1 would be ill-formed: /home/vm/Monero-TipBot/src/Discord.cpp:152:41: error: invalid user-defined conversion from ‘const SleepyDiscord::Snowflake’ to ‘std::cxx11::basic_string&&’ [-fpermissive] UsrMsg.Channel.id_str = message.channelID; ^ In file included from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/user.h:4:0, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/message.h:2, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:13, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/websocketpp_websocket.h:15, from /home/vm/Monero-TipBot/src/Discord.h:16, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: candidate is: SleepyDiscord::Snowflake::operator const string&() [with DiscordObject = SleepyDiscord::Channel; std::cxx11::string = std::__cxx11::basic_string] operator const std::string&() { return raw; } ^ /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: passing ‘const SleepyDiscord::Snowflake*’ as ‘this’ argument discards qualifiers /home/vm/Monero-TipBot/src/Discord.cpp:152:31: error: passing ‘const SleepyDiscord::Snowflake’ as ‘this’ argument discards qualifiers [-fpermissive] UsrMsg.Channel.id_str = message.channelID; ^ In file included from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/user.h:4:0, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/message.h:2, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:13, from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/websocketpp_websocket.h:15, from /home/vm/Monero-TipBot/src/Discord.h:16, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/snowflake.h:35:3: note: in call to ‘SleepyDiscord::Snowflake::operator const string&() [with DiscordObject = SleepyDiscord::Channel; std::cxx11::string = std::cxx11::basic_string]’ operator const std::string&() { return raw; } ^ /home/vm/Monero-TipBot/src/Discord.cpp:152:31: error: conversion from ‘const string {aka const std::__cxx11::basic_string}’ to ‘std::cxx11::basic_string&&’ discards qualifiers [-fpermissive] UsrMsg.Channel.id_str = message.channelID; ^ /home/vm/Monero-TipBot/src/Discord.cpp: In function ‘void getDiscordUsers(Discord&, std::set&, const SleepyDiscord::Snowflake&, const short unsigned int&, const SleepyDiscord::Snowflake&)’: /home/vm/Monero-TipBot/src/Discord.cpp:220:70: error: no matching function for call to ‘Discord::listMembers(const SleepyDiscord::Snowflake&, const short unsigned int&, const SleepyDiscord::Snowflake&)’ auto guildInfo = me.listMembers(snowyServer, limit, snowyUser).vector(); ^ In file included from /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/websocketpp_websocket.h:15:0, from /home/vm/Monero-TipBot/src/Discord.h:16, from /home/vm/Monero-TipBot/src/Discord.cpp:14: /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:115:32: note: candidate: SleepyDiscord::ArrayResponse SleepyDiscord::BaseDiscordClient::listMembers(SleepyDiscord::Snowflake, uint16_t, std::cxx11::string) ArrayResponse listMembers (Snowflake serverID, uint16_t limit = 0, std::string af ^ /home/vm/Monero-TipBot/extern/sleepy-discord/include/sleepy_discord/client.h:115:32: note: no known conversion for argument 3 from ‘const SleepyDiscord::Snowflake’ to ‘std::cxx11::string {aka std::__cxx11::basic_string}’ /home/vm/Monero-TipBot/src/Discord.cpp:223:26: error: unable to deduce ‘auto&&’ from ‘guildInfo’ for (auto user : guildInfo) ^

yourWaifu commented 6 years ago

I found it really strange that operator const std::string&() isn't working in your case. I'm going to guess that a static_cast<std::string>() might fix most of the issues.

TylerTheFox commented 6 years ago

It's only the new version of sleepy discord. I just compiled the old version without issues. And only on Linux. Windows is OK for some reason.

static cast or wrapping it in std::string does not work.

TylerTheFox commented 6 years ago

I reverted to this version of snowflake.h and it compiled w/o issues https://github.com/Brandantl/Monero-TipBot/blob/develop/extern/sleepy-discord/include/sleepy_discord/snowflake.h

TylerTheFox commented 6 years ago

This was because of conflicts with master.