I’m having a problem with forward declarations in a nested namespace. I put a forward declaration for a class or struct in a nested namespace and when I try to use it in the parent of that namespace I get an error. I don’t know what to do.
This is what the code looks like:
#include "Data\Types.hpp"
namespace GameEngine
{
class Console
{
public:
class Renderer : public RenderComponent2D
{
public:
Renderer(Console*, const GameEngine::DataProcessing::FontData*);
//...
and in Data\Types.hpp:
namespace GameEngine
{
namespace DataProcessing
{
struct FontData;
//...
and the error MinGW gives me is :
'FontData' in namespace 'GameEngine::DataProcessing' does not name a type
I appreciate any help or suggestions with this problem.
May be problem in declaration of method. You are already inside GameEngine namespace:
But in declaration you use this namespace too :
Try it without GameEngine :