Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when compiling develop branch on windows with VS2019 implementing AppCommands #246

Open
botn365 opened this issue Sep 30, 2021 · 1 comment

Comments

@botn365
Copy link

botn365 commented Sep 30, 2021

error compiling when trying to use AppCommands with c++17
on develop branch

code

            TestClient client("TOKEN",1);

            std::vector<SleepyDiscord::Intent> intents;
            intents.push_back(SleepyDiscord::Intent::SERVER_MESSAGES);
            intents.push_back(SleepyDiscord::Intent::SERVER_INTEGRATIONS);
            client.setIntents(intents);

            SleepyDiscord::Snowflake<SleepyDiscord::DiscordObject> app("APP ID");
            SleepyDiscord::Snowflake<SleepyDiscord::Server> server("server ID");

            auto response = client.createServerAppCommand(app,server,"test","test command");
            auto command = response.cast(); //line that couses compiling to fail

            client.commands.push_back(std::move(command));
            client.run();

error

D:\programs\vscode-idea\VC\Tools\MSVC\14.29.30133\include\cstdbool(22): warning C4996: '_Header_cstdbool': warning STL4004: <ccomplex>, <cstdalign>, <cstdbool>, and <ctgmath> are deprecated in C++17. You can define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
D:\programs\vscode-idea\VC\Tools\MSVC\14.29.30133\include\xmemory(710): error C2672: 'std::construct_at': no matching overloaded function found
D:\programs\vscode-idea\VC\Tools\MSVC\14.29.30133\include\xmemory(1610): note: see reference to function template instantiation 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,SleepyDiscord::AppCommand::Option::Choice&>(_Alloc &,_Objty *const ,SleepyDiscord::AppCommand::Option::Choice &)' being compiled
        with
        [
            _Alloc=std::allocator<SleepyDiscord::AppCommand::Option::Choice>,
            _Ty=SleepyDiscord::AppCommand::Option::Choice,
            _Objty=SleepyDiscord::AppCommand::Option::Choice
        ]

...

D:\programs\vscode-idea\VC\Tools\MSVC\14.29.30133\include\vector(554): note: while compiling class template member function 'std::vector<SleepyDiscord::AppCommand::Option::Choice,std::allocator<SleepyDiscord::AppCommand::Option::Choice>>::vector(const std::vector<SleepyDiscord::AppCommand::Option::Choice,std::allocator<SleepyDiscord::AppCommand::Option::Choice>> &)'
D:\dev\cpp\discord-bot-test\deps\sleepy-discord\include\sleepy_discord\slash_commands.h(107): note: see reference to function template instantiation 'std::vector<SleepyDiscord::AppCommand::Option::Choice,std::allocator<SleepyDiscord::AppCommand::Option::Choice>>::vector(const std::vector<SleepyDiscord::AppCommand::Option::Choice,std::allocator<SleepyDiscord::AppCommand::Option::Choice>> &)' being compiled
D:\dev\cpp\discord-bot-test\deps\sleepy-discord\include\sleepy_discord\slash_commands.h(94): note: see reference to class template instantiation 'std::vector<SleepyDiscord::AppCommand::Option::Choice,std::allocator<SleepyDiscord::AppCommand::Option::Choice>>' being compiled
D:\programs\vscode-idea\VC\Tools\MSVC\14.29.30133\include\xmemory(710): error C2783: '_Ty *std::construct_at(_Ty *const ,_Types &&...) noexcept(<expr>)': could not deduce template argument for '<unnamed-symbol>'
D:\programs\vscode-idea\VC\Tools\MSVC\14.29.30133\include\xutility(142): note: see declaration of 'std::construct_at'
D:\programs\vscode-idea\VC\Tools\MSVC\14.29.30133\include\xmemory(714): error C2280: 'SleepyDiscord::AppCommand::Option::Choice::Choice(const SleepyDiscord::AppCommand::Option::Choice &)': attempting to reference a deleted function
D:\dev\cpp\discord-bot-test\deps\sleepy-discord\include\sleepy_discord\slash_commands.h(82): note: compiler has generated 'SleepyDiscord::AppCommand::Option::Choice::Choice' here
D:\dev\cpp\discord-bot-test\deps\sleepy-discord\include\sleepy_discord\slash_commands.h(82): note: 'SleepyDiscord::AppCommand::Option::Choice::Choice(const SleepyDiscord::AppCommand::Option::Choice &)': function was implicitly deleted because a base class invokes a deleted or inaccessible function 'rapidjson::GenericValue<rapidjson::UTF8<char>,rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::GenericValue(const rapidjson::GenericValue<rapidjson::UTF8<char>,rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>> &)'

maby related but i had to
#include
in json_wrapper.h to get the project to compile at all

@yourWaifu
Copy link
Owner

yourWaifu commented Sep 30, 2021

command option choices can't be copied, and that might be what's going on maybe. I might need to make some changes in the library to have it use move when needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants