Skip to content
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

ObjectResponse Linking Error #238

Open
alexgb0 opened this issue Aug 8, 2021 · 3 comments
Open

ObjectResponse Linking Error #238

alexgb0 opened this issue Aug 8, 2021 · 3 comments

Comments

@alexgb0
Copy link

alexgb0 commented Aug 8, 2021

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.

@yourWaifu
Copy link
Owner

yourWaifu commented Aug 8, 2021

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?

@alexgb0
Copy link
Author

alexgb0 commented Aug 9, 2021

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)

@yourWaifu
Copy link
Owner

yourWaifu commented Aug 9, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants