Пытаясь получить слегка измененную версию одного из примеров использования Discord Game SDK для создания расширенного присутствия для пользователя, я столкнулся с ошибками при попытке связать указанные библиотеки с моим кодом.Библиотеки, заголовки и т. д. можно найти здесь: https://discord.com/developers/docs/dev ... s/game-sdk
(я использую v3.2.1)< /p>
Мой код такой:
#include
#include
#include
#include
#include
#include "../include/discord/discord.h"
struct DiscordState {
std::unique_ptr core;
};
namespace {
volatile bool interrupted{ false };
}
int main(int argc, char* argv[]) {
// Make sure we have the right number of arguments
if (argc < 2 || argc > 2) {
fprintf(stderr, "Incorrect number of arguments: expected 1, received %d.\n", (argc - 1));
fprintf(stderr, "USAGE: ./StremioRichPresence [CLIENT_ID]\n");
exit(1);
}
printf("StremioRichPresence\n");
// Check if the argument represents an actual integer for a client id, otherwise complain.
signed long int clientID = NULL;
try {
clientID = std::stoi(argv[1]);
} catch (const std::invalid_argument& e) {
fprintf(stderr, "Argument for client ID is not a valid number.\n");
exit(1);
} catch (const std::out_of_range& e) {
fprintf(stderr, "Argument for client ID is a number too large to fit into the specified integer type.\n");
exit(1);
}
printf("clientID is %ld", clientID);
DiscordState state;
discord::Core* core{};
auto response = discord::Core::Create(clientID, DiscordCreateFlags_Default, &core);
state.core.reset(core);
if (!state.core) {
std::cout ActivityManager().UpdateActivity(activity, [](discord::Result result) {
std::cout
Подробнее здесь: https://stackoverflow.com/questions/792 ... rly-linked