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

Unresolved external symbols errors when compiling the example code in docs #79

Closed Skorpo closed 6 years ago

Skorpo commented 6 years ago

I completed all steps of installation and setup, and arrived to the part in which I could do a test run of the framework. Upon compiling, I received multiple unresolved external symbol errors during compilation of the following code:

#include "sleepy_discord/websocketpp_websocket.h"

class WebsocketppDiscordClient : public SleepyDiscord::DiscordClient {
public:
    using SleepyDiscord::DiscordClient::DiscordClient;
    void onMessage(SleepyDiscord::Message message) {
        if (message.startsWith("whcg hello"))
            sendMessage(message.channelID, "Hello " + message.author.username);
    }
};

int main() {
    WebsocketppDiscordClient client("token", 2);
    client.run();

The compile fails, and I receive the following errors:

1>------ Build started: Project: hello, Configuration: Release Win32 ------ 1>main.cpp 1>main.obj : error LNK2001: unresolved external symbol "private: virtual void thiscall SleepyDiscord::WebsocketppDiscordClient::runAsync(void)" (?runAsync@WebsocketppDiscordClient@SleepyDiscord@@EAEXXZ) 1>main.obj : error LNK2001: unresolved external symbol "private: virtual void thiscall SleepyDiscord::WebsocketppDiscordClient::send(class std::basic_string<char,struct std::char_traits,class std::allocator >)" (?send@WebsocketppDiscordClient@SleepyDiscord@@EAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 1>main.obj : error LNK2001: unresolved external symbol "private: virtual void thiscall SleepyDiscord::WebsocketppDiscordClient::disconnect(unsigned int,class std::basic_string<char,struct std::char_traits,class std::allocator >)" (?disconnect@WebsocketppDiscordClient@SleepyDiscord@@EAEXIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 1>main.obj : error LNK2001: unresolved external symbol "private: virtual bool thiscall SleepyDiscord::WebsocketppDiscordClient::connect(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?connect@WebsocketppDiscordClient@SleepyDiscord@@EAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void thiscall SleepyDiscord::WebsocketppDiscordClient::sleep(unsigned int)" (?sleep@WebsocketppDiscordClient@SleepyDiscord@@MAEXI@Z) 1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void thiscall SleepyDiscord::WebsocketppDiscordClient::onError(enum SleepyDiscord::ErrorCode,class std::basic_string<char,struct std::char_traits,class std::allocator >)" (?onError@WebsocketppDiscordClient@SleepyDiscord@@MAEXW4ErrorCode@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 1>main.obj : error LNK2001: unresolved external symbol "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) 1>main.obj : error LNK2001: unresolved external symbol "public: virtual void thiscall SleepyDiscord::WebsocketppDiscordClient::run(void)" (?run@WebsocketppDiscordClient@SleepyDiscord@@UAEXXZ) 1>main.obj : error LNK2001: unresolved external symbol "public: thiscall SleepyDiscord::WebsocketppDiscordClient::~WebsocketppDiscordClient(void)" (??1WebsocketppDiscordClient@SleepyDiscord@@QAE@XZ) 1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall SleepyDiscord::WebsocketppDiscordClient::WebsocketppDiscordClient(class std::basic_string<char,struct std::char_traits,class std::allocator >,char)" (??0WebsocketppDiscordClient@SleepyDiscord@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@D@Z) 1>C:\Users\shawn\documents\visual studio 2017\Projects\hello\Release\hello.exe : fatal error LNK1120: 10 unresolved externals 1>Done building project "hello.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Skorpo commented 6 years ago

After recompiling sleepy_discord, it managed to work. Disregard this issue.