sleepy-discord icon indicating copy to clipboard operation
sleepy-discord copied to clipboard

LNK2001 error on compiling with visual studio 2017

Open HrX03 opened this issue 6 years ago • 15 comments

Today i wanted to try this library and after several hours of compiling, copying, downloading, etc. i was able to set up the environment. So i wanted to test the library by copying and pasting the test code from the readme into a cpp file and, after all the linking directories, libraries and input thingies, i was ready to build. When i tried to build, those errors showed up (sorry the logs are italian because i am italian):

1>------ Inizio compilazione: Progetto: Discord Bot, Configurazione: Release Win32 ------
1>Origine.obj : error LNK2001: simbolo esterno "private: virtual void __thiscall SleepyDiscord::WebsocketppDiscordClient::runAsync(void)" (?runAsync@WebsocketppDiscordClient@SleepyDiscord@@EAEXXZ) non risolto
1>Origine.obj : error LNK2001: simbolo esterno "private: virtual void __thiscall SleepyDiscord::WebsocketppDiscordClient::send(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?send@WebsocketppDiscordClient@SleepyDiscord@@EAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) non risolto
1>Origine.obj : error LNK2001: simbolo esterno "private: virtual void __thiscall SleepyDiscord::WebsocketppDiscordClient::disconnect(unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?disconnect@WebsocketppDiscordClient@SleepyDiscord@@EAEXIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) non risolto
1>Origine.obj : error LNK2001: simbolo esterno "private: virtual bool __thiscall SleepyDiscord::WebsocketppDiscordClient::connect(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?connect@WebsocketppDiscordClient@SleepyDiscord@@EAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) non risolto
1>Origine.obj : error LNK2001: simbolo esterno "protected: virtual void __thiscall SleepyDiscord::WebsocketppDiscordClient::sleep(unsigned int)" (?sleep@WebsocketppDiscordClient@SleepyDiscord@@MAEXI@Z) non risolto
1>Origine.obj : error LNK2001: simbolo esterno "protected: virtual void __thiscall SleepyDiscord::WebsocketppDiscordClient::onError(enum SleepyDiscord::ErrorCode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?onError@WebsocketppDiscordClient@SleepyDiscord@@MAEXW4ErrorCode@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) non risolto
1>Origine.obj : error LNK2001: simbolo esterno "public: virtual struct SleepyDiscord::Timer __thiscall SleepyDiscord::WebsocketppDiscordClient::schedule(class std::function<void __cdecl(void)>,__int64)" (?schedule@WebsocketppDiscordClient@SleepyDiscord@@UAE?AUTimer@2@V?$function@$$A6AXXZ@std@@_J@Z) non risolto
1>Origine.obj : error LNK2001: simbolo esterno "public: virtual void __thiscall SleepyDiscord::WebsocketppDiscordClient::run(void)" (?run@WebsocketppDiscordClient@SleepyDiscord@@UAEXXZ) non risolto
1>Origine.obj : error LNK2001: simbolo esterno "public: __thiscall SleepyDiscord::WebsocketppDiscordClient::~WebsocketppDiscordClient(void)" (??1WebsocketppDiscordClient@SleepyDiscord@@QAE@XZ) non risolto
1>Origine.obj : error LNK2001: simbolo esterno "public: __thiscall SleepyDiscord::WebsocketppDiscordClient::WebsocketppDiscordClient(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char)" (??0WebsocketppDiscordClient@SleepyDiscord@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@D@Z) non risolto
1>sleepy_discord.lib(client.obj) : error LNK2001: simbolo esterno "public: static class SleepyDiscord::GenericSession * (__cdecl* SleepyDiscord::CustomSession::init)(void)" (?init@CustomSession@SleepyDiscord@@2Q6APAVGenericSession@2@XZA) non risolto
1>C:\Users\dnbia\Documents\Cpp projects\Discord Bot\Release\Discord Bot.exe : fatal error LNK1120: 11 esterni non risolti
1>Compilazione progetto "Discord Bot.vcxproj" NON COMPLETATA.
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========

I tried everything! Adding libraries, directories, tried to recompile some things and so on but no luck! Please help!

HrX03 avatar Jun 29 '18 14:06 HrX03

It looks like you are missing websocketpp. Make sure you have a folder called websocketpp in your deps/include. If you don't, the setup script should be able to download it for you.

yourWaifu avatar Jun 29 '18 18:06 yourWaifu

i'm sure that websocketpp was downloaded correctly and the folder is there

HrX03 avatar Jun 29 '18 18:06 HrX03

Can you send your list of include directories for your bot?

yourWaifu avatar Jun 29 '18 19:06 yourWaifu

Here you go: C:\Users<myuser>\Documents\Cpp projects\sleepy-discord C:\Users<myuser>\Documents\Cpp projects\sleepy-discord\deps C:\Users<myuser>\Documents\Cpp projects\sleepy-discord\deps\include C:\Users<myuser>\Documents\Cpp projects\sleepy-discord\deps\lib C:\Users<myuser>\Documents\Cpp projects\sleepy-discord\include\sleepy_discord C:\Users<myuser>\Documents\Cpp projects\sleepy-discord\include\sleepy_discord\IncludeNonexistent

HrX03 avatar Jun 29 '18 20:06 HrX03

Try changing projects\sleepy-discord\include\sleepy_discord to projects\sleepy-discord\include

Try a recompile of Sleepy Discord, you might have compiled it before setup. The errors you are getting are because the library couldn't detect dependency header files. I can see from the errors that this is happening for both websocketpp and cpr.

There is also the examples from the examples folder, try taking a look at hello. If hello doesn't compile with the same error messages then you want to send me your files through a private or direct message.

yourWaifu avatar Jun 29 '18 21:06 yourWaifu

yeah the hello project gives same errors, now im gonna change the directories

HrX03 avatar Jun 29 '18 21:06 HrX03

If you didn't make any changes to hello's project properties. Then it's most likely not an issue with your project properties but most likely issues with you deps folder, assuming that you are getting the same errors.

yourWaifu avatar Jun 29 '18 21:06 yourWaifu

Yeah I cleaned and tried to recompile sleepy discord and now I'm getting more than 100 errors, idk why. Can't you just give some precomputed builds with all the deps in it?

HrX03 avatar Jun 29 '18 21:06 HrX03

I have directions for contacting me on Discord here https://yourwaifu.github.io/sleepy-discord/documentation.html#a-warm-welcome . We need to be on a common server to direct message each other on Discord so that's what Discord API server is for.

yourWaifu avatar Jun 29 '18 21:06 yourWaifu

No I can't, because of the many different setups and configurations that sleepy discord can be in. Maybe in the future, as most people don't use custom configurations. Maybe, once I can figure out how to do it automatically.

yourWaifu avatar Jun 29 '18 22:06 yourWaifu

(VS2017 Community) I am having the same issue on a slightly smaller scale. (62 Errors + 1 Warning). Repository: https://github.com/SalmonSeasoning/DiscordRPCTest For a more simplistic view of my VS library configurations, take a look at LIBRARIES. It complains about 61 unresolved variables all apparently originating from your library. Everything is configured for building on either Win32 ("x86") or Win64 ("x64"). Nothing has been modified so the exact result from my build should appear on your build as well. /NODEFAULTLIB doesn't work either.

Log (build x86):

1>------ Build started: Project: DiscordWindowsBot, Configuration: Debug x64 ------
1>Source.cpp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Source.obj : error LNK2019: unresolved external symbol "public: __cdecl SleepyDiscord::Message::~Message(void)" (??1Message@SleepyDiscord@@QEAA@XZ) referenced in function "private: virtual void __cdecl DiscordClient::onMessage(struct SleepyDiscord::Message)" (?onMessage@DiscordClient@@EEAAXUMessage@SleepyDiscord@@@Z)
1>Source.obj : error LNK2019: unresolved external symbol "public: __cdecl SleepyDiscord::BaseDiscordClient::~BaseDiscordClient(void)" (??1BaseDiscordClient@SleepyDiscord@@QEAA@XZ) referenced in function "public: __cdecl DiscordClient::~DiscordClient(void)" (??1DiscordClient@@QEAA@XZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: struct SleepyDiscord::ObjectResponse<struct SleepyDiscord::Message> __cdecl SleepyDiscord::BaseDiscordClient::sendMessage(struct SleepyDiscord::Snowflake<class SleepyDiscord::Channel>,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool)" (?sendMessage@BaseDiscordClient@SleepyDiscord@@QEAA?AU?$ObjectResponse@UMessage@SleepyDiscord@@@2@U?$Snowflake@VChannel@SleepyDiscord@@@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) referenced in function "private: virtual void __cdecl DiscordClient::onMessage(struct SleepyDiscord::Message)" (?onMessage@DiscordClient@@EEAAXUMessage@SleepyDiscord@@@Z)
1>Source.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl SleepyDiscord::BaseDiscordClient::run(void)" (?run@BaseDiscordClient@SleepyDiscord@@UEAAXXZ) referenced in function main
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onReady(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onReady@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onResumed(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onResumed@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDeleteServer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onDeleteServer@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditServer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditServer@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onBan(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onBan@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onUnban(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onUnban@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onMember(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onMember@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onRemoveMember(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onRemoveMember@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDeleteMember(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onDeleteMember@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditMember(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditMember@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onRole(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onRole@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDeleteRole(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onDeleteRole@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditRole(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditRole@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditEmojis(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditEmojis@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onMemberChunk(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onMemberChunk@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDeleteChannel(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onDeleteChannel@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditChannel(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditChannel@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onPinMessages(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onPinMessages@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onPresenceUpdate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onPresenceUpdate@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditUser(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditUser@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditUserNote(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditUserNote@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditUserSettings(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditUserSettings@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditVoiceState(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditVoiceState@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onTyping(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onTyping@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDeleteMessage(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onDeleteMessage@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditMessage(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditMessage@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onBulkDelete(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onBulkDelete@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditVoiceServer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditVoiceServer@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onServerSync(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onServerSync@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onRelationship(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onRelationship@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onRemoveRelationship(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onRemoveRelationship@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDeleteRelationship(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onDeleteRelationship@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onReaction(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onReaction@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onRemoveReaction(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onRemoveReaction@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDeleteReaction(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onDeleteReaction@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onRemoveAllReaction(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onRemoveAllReaction@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDeleteAllReaction(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onDeleteAllReaction@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onMessage(struct SleepyDiscord::Message)" (?onMessage@BaseDiscordClient@SleepyDiscord@@MEAAXUMessage@2@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditedMessage(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditedMessage@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onServer(struct SleepyDiscord::Server)" (?onServer@BaseDiscordClient@SleepyDiscord@@MEAAXUServer@2@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onChannel(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onChannel@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onEditedRole(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onEditedRole@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDispatch(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?onDispatch@BaseDiscordClient@SleepyDiscord@@MEAAXPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onHeartbeat(void)" (?onHeartbeat@BaseDiscordClient@SleepyDiscord@@MEAAXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onHeartbeatAck(void)" (?onHeartbeatAck@BaseDiscordClient@SleepyDiscord@@MEAAXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onInvaldSession(void)" (?onInvaldSession@BaseDiscordClient@SleepyDiscord@@MEAAXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onDisconnect(void)" (?onDisconnect@BaseDiscordClient@SleepyDiscord@@MEAAXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onResume(void)" (?onResume@BaseDiscordClient@SleepyDiscord@@MEAAXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onQuit(void)" (?onQuit@BaseDiscordClient@SleepyDiscord@@MEAAXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onResponse(struct SleepyDiscord::Response)" (?onResponse@BaseDiscordClient@SleepyDiscord@@MEAAXUResponse@2@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::sleep(unsigned int)" (?sleep@BaseDiscordClient@SleepyDiscord@@MEAAXI@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::fileRead(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > * const)" (?fileRead@BaseDiscordClient@SleepyDiscord@@MEAAXPEBDQEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::tick(float)" (?tick@BaseDiscordClient@SleepyDiscord@@MEAAXM@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::onError(enum SleepyDiscord::ErrorCode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?onError@BaseDiscordClient@SleepyDiscord@@MEAAXW4ErrorCode@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2019: unresolved external symbol "protected: void __cdecl SleepyDiscord::BaseDiscordClient::start(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char)" (?start@BaseDiscordClient@SleepyDiscord@@IEAAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@D@Z) referenced in function "public: __cdecl SleepyDiscord::BaseDiscordClient::BaseDiscordClient(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0BaseDiscordClient@SleepyDiscord@@QEAA@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl SleepyDiscord::BaseDiscordClient::runAsync(void)" (?runAsync@BaseDiscordClient@SleepyDiscord@@MEAAXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 const __cdecl SleepyDiscord::BaseDiscordClient::getEpochTimeMillisecond(void)" (?getEpochTimeMillisecond@BaseDiscordClient@SleepyDiscord@@MEAA?B_JXZ)
1>D:\Workspaces\DiscordWindowsBot\x64\Debug\DiscordWindowsBot.exe : fatal error LNK1120: 61 unresolved externals
1>Done building project "DiscordRPC.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Edit: Ignore the fact that I left my Bot Token and Rich Presence Client ID in the repository. The Bot Token links to a bot that is not in any Discord guilds and the RP Client ID is just a client id.

tyqualters avatar Jul 01 '18 06:07 tyqualters

@SalmonSeasoning First of all you forgot about Externals/sleepy_discord/include/sleepy_discord/IncludeNonexistent, and make sure it's last. Other then that, I would recompile or rebuild the library if you havn't already. I noticed that all the unresolved external symbols are defined in "default_functions.cpp", it looks like it may have never compiled or linked that file. I'll clone your repo and see what happens on my machine and report back.

I know you said to ignore but please don't show your token. It's suppose to be secret.

yourWaifu avatar Jul 01 '18 18:07 yourWaifu

I have done as you said. I trashed the old library, I cloned the repo from master branch, ran setup.py again, and integrated the IncludeNonexistant folder into the project with all available headers. However, all of this did not resolve the 62 errors that pop up when including the library itself. I then tried to import "default_functions.cpp" and it came down to just 2 errors that did not resolve.

1>------ Build started: Project: DiscordWindowsBot, Configuration: Debug Win32 ------
1>Source.cpp
1>d:\workspaces\discordwindowsbot\externals\sleepy_discord\sleepy_discord\default_functions.cpp(1): fatal error C1083: Cannot open include file: 'client.h': No such file or directory
1>Done building project "DiscordRPC.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I think the issue is that the file cannot find the client header when compiled and/or the file itself is not being included at all.

Thanks for your reply,

also it's a throw-away application. I went ahead and changed the token anyway.

Edit: I did not update the repository. Here is the new code portion.

// External Libraries
#include <json/json.h>								// JSONCPP			- o -	JSON management in C++
#include <cpr/cpr.h>								// CPR				- o -	Easy web integration (requires CURL)
#include <discord_rpc.h>							// DiscordRPC		- o -	Discord Rich Presence
#include <sleepy_discord/sleepy_discord.h>			// SleepyDiscord	- o -	Discord Bot API
#include <GL/glew.h>								// GLEW				- o -	OpenGL API
#include <GLFW/glfw3.h>								// GLFW				- o -	OpenGL Window API
#include <sleepy_discord/IncludeNonexistent/uWS/uWS.h>
#include <sleepy_discord/IncludeNonexistent/websocketpp/config/asio_client.hpp>

#include "../Externals/sleepy_discord/sleepy_discord/default_functions.cpp"

tyqualters avatar Jul 01 '18 19:07 tyqualters

@SalmonSeasoning I tried to find sleepy_discord.lib but couldn't find it but I ran the setup.py script for both websocketpp and cpr and compiled curl. I then compiled sleepy_discord.lib. I build your bot on the release configuration because your debug configuration wasn't even linking my library. I then ran into issues with your code and fixed them by removing them. I also ran into issues with the compiler not outputing obj files, and somehow fixed it by playing around with the project properties. I then added IncludeNonexistent to the include paths. I also added libcurl_a.lib, Ws2_32.lib, crypt32.lib, wldap32.lib, and Normaliz.lib. And it worked, didn't test your bot tho.

Edit: this was written before your last comment, I also haven't read your comment when I wrote this edit.

Edit2:

I then tried to import "default_functions.cpp"

Remove default_functions.cpp, it doesn't belong in your code.

I think the issue is that the file cannot find the client header when compiled and/or the file itself is not being included at all.

no, if it couldn't find client.h then it would just not output a .lib file and give an error.

#include "../Externals/sleepy_discord/sleepy_discord/default_functions.cpp"

remove this also.

yourWaifu avatar Jul 01 '18 19:07 yourWaifu

I've done close to exactly as you said (websocketpp, cpr, curl installed). I had to leave out libcurl_a.lib because the universal version of the library I have doesn't even have a compiled .lib at all. However, at this point, I'm sure it's my system being buggy so I'm just going to scratch and restart the solution with all of the same code and see if that works (especially since a GLFW3 .lib error popped out of nowhere).

I think OP's issue is that he hasn't gone into the Sleepy Discord .sln and built for x64 (Debug) and included the .lib into his project solution.

(I tried it -both x86 and x64- and actually had an error pop up saying it was built for x86 and not x64 and building it for the "Release" just threw a bunch of errors regardless.)

I am going to leave my live repository up for reference for a day or two. Thanks for the help.

I'll post a separate "Issue" if I find the same results after a clean install of everything and can't find a proper resolution for it.

tyqualters avatar Jul 01 '18 22:07 tyqualters