Open alexgb0 opened 3 years ago
What's the error message? Also this library is made for C++ 11. Sounds like a C++ standard mismatch between the library and your bot. I have no idea because I don't know what the error is. Also what do you mean by proper error?
I get this error with set (CMAKE_CXX_STANDARD 11)
. It doesn't give any linking error with 17 nor 20
error LNK2019: unresolved external symbol "public: __cdecl SleepyDiscord::Channel::Channel(class std::basic_string_view<char,struct std::char_traits<char> > const &)" (??0Channel@SleepyDiscord@@QEAA@AEBV?$basic_string_view@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: __cdecl SleepyDiscord::ObjectResponse<struct SleepyDiscord::Channel>::operator struct SleepyDiscord::Channel(void)" (??B?$ObjectResponse@UChannel@SleepyDiscord@@@SleepyDiscord@@QEAA?AUChannel@1@XZ)
error LNK2019: unresolved external symbol "public: __cdecl SleepyDiscord::Server::Server(class std::basic_string_view<char,struct std::char_traits<char> > const &)" (??0Server@SleepyDiscord@@QEAA@AEBV?$basic_string_view@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: __cdecl SleepyDiscord::ObjectResponse<struct SleepyDiscord::Server>::operator struct SleepyDiscord::Server(void)" (??B?$ObjectResponse@UServer@SleepyDiscord@@@SleepyDiscord@@QEAA?AUServer@1@XZ)
Yeah, your library was compiled for C++ 17 and up. Which allows for the user of std::string_view, which isn't available in C++11. I think the error message is fairly clear. I can't really replace those errors, nor am I sure of a way to detect it. There might be a way to prevent the issue, maybe, but I currently don't know of a solution as of right now.
Error
ObjectResponse (and many more probably) gives a linking error if the c++ standard is not higher than 17
It will be more convenient if it gives a proper error instead of giving a linking error. Because it took me a whole day to realize the problem.