C++ invalid use of incomplete type, in derived class [duplicate]

  c++, gcc

So I have a client class, which looks like so:

#pragma once

#include "command_container.h"
#include "commands/help.command.hpp"
 
class HelpCommand;
class Client : public SleepyDiscord::DiscordClient
{
    ...
};

And a command class:

#pragma once

#include "client.hpp"

class Client;
class Command
{
    ...
};

And lastly a help_command class which derives of command:

#pragma once

#include "../command.hpp"

class HelpCommand : public Command
{
    ...
};

However, in the help_command class, GCC complains about the following things:

invalid use of incomplete type ‘class Command’
command_container.h(5, 7): forward declaration of ‘class Command’

For some reason, it won’t allow me to make a subclass from command, claiming it’s an incomplete type.

I’m not really sure what to do here, any help would be appreciated.

Source: Windows Questions C++

LEAVE A COMMENT