Smertig / banana

🍌 Modern C++ Telegram Bot API library
https://smertig.github.io/banana/master
MIT License
41 stars 4 forks source link

MSC 2019 Compiling error #15

Closed mbsteixeira closed 3 years ago

mbsteixeira commented 3 years ago

Compiling the test program :

#include <banana/api.hpp>
#include <banana/agent/cpr.hpp>

#include <iostream>

static_assert(std::is_same_v<banana::api_result<banana::api::message_t, banana::agent::cpr_async>, std::future<banana::api::message_t>>);

int main(int argc, const char** argv) {
    if (argc < 3) {
        std::cout << "usage: " << (argc > 0 ? argv[0] : "./self") << " token target [name] [os]\n";
        return 2;
    }

    const std::string token  = argv[1];
    const std::string target = argv[2];
    const std::string name   = argc > 3 ? argv[3] : "<unknown>";
    const std::string os     = argc > 4 ? argv[4] : "<unknown>";

    const std::string message_text = "Hello from " + name + " at " + os + "!";

    try {
        banana::agent::cpr_async agent(token);

        std::cout << "bot name: " << banana::api::get_me(agent).get().username.value() << "\n";
        std::cout << "message sent: " << banana::api::send_message(agent, { target, message_text }).get().message_id << "\n";
    }
    catch (std::exception& e) {
        std::cout << "exception while running " << name << ": " << e.what() << "\n";
        return 1;
    }
}

with Microsoft Visual Studio Community 2019 Version 16.9.6, gives me the following erros :

Severity    Code    Description Project File    Line    Suppression State
Error (active)  E0304   no instance of function template "banana::api::send_message" matches the argument list  TesteBanana F:\downloads\banana-master\_BUILD_DIR\TesteBanana\teste1.cpp    27  
Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol "public: __cdecl banana::agent::basic_cpr_monadic::basic_cpr_monadic(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0basic_cpr_monadic@agent@banana@@QEAA@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: __cdecl banana::agent::meta::unwrap_blocking<class banana::agent::basic_cpr_monadic>::unwrap_blocking<class banana::agent::basic_cpr_monadic>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0?$unwrap_blocking@Vbasic_cpr_monadic@agent@banana@@@meta@agent@banana@@QEAA@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)  TesteBanana F:\downloads\banana-master\_BUILD_DIR\TesteBanana\teste1.obj    1   
mbsteixeira commented 3 years ago

Bad configuration on my side.