'Missing type despite forward declaration [closed]

I'm trying to create a basic factory function that returns a pointer to a forward-declared class, as follows below:

#ifndef EQUATION_PLUGIN_HPP
#define EQUATION_PLUGIN_HPP
//! \file equation_plugin.hpp
//  \brief Definition of EquationPlugin

#include <string>

#include <shared_library.hpp>

class Equation;
class PluginManager;

//! ...
class EquationPlugin {
    friend class PluginManager;
  private:
    ...
    PluginManager *manager;
  protected:
    const int nvars;
  public:
    EquationPlugin(int n) : nvars(n) {}
    virtual ~EquationPlugin() = default;
    virtual Equation* CreateEquation() = 0;
};


#endif

As you can see, there are two forward declarations: one for Equation, and one for PluginManager. This seems like a pretty basic thing to me, but for some reason I keep getting the following error from g++:

error: ‘Equation’ does not name a type
   31 |     virtual Equation* CreateEquation() = 0;

I'm not sure why I'm getting an error with Equation but not with PluginManager. Sometimes these kinds of issues are caused by circular dependencies, but equation_plugin.hpp only has two includes: string, which comes from the STL, and shared_library.hpp, which is a wrapper around shared library functions that depend only on dlfcn.h and string. The header file for PluginManager does forward declare EquationPlugin, but it doesn't make any reference to Equation, and the header file for Equation is independent of both. Therefore, circular dependencies shouldn't be an issue.

I'm sort of at a loss for what the issue is at this point. Do any of you have any advice for what might be going on?

c++


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source