Smertig / banana

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

Link error on windows 64 bits #16

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

static_assert(std::is_same_v<banana::api_result<banana::api::message_t, banana::agent::cpr_async>, std::futurebanana::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] : ""; const std::string os = argc > 4 ? argv[4] : "";

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,class std::allocator >)" (??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::unwrap_blocking(class std::basic_string<char,struct std::char_traits,class std::allocator >)" (??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

Finally it's running fine!!