Using a struct in another class

Hello,

I have defined a struct in class a. I want to access this struct in class b. But I am getting the error:

“Unknown override specifier”

Pseudo code:
a.h file


USTRUCT() 
struct FStructA {
     GENERATED_USTRUCT_BODY()
     
    ~FStructA();
    FStructA(){}
};

b.h file

#include "a.h"

USTRUCT()
struct FStructB {
    GENERATED_USTRUCT_BODY()

    FStructA aStruct;

    ~FStructB();
    FStructB()
};

This causes the above error. Any idea what I am missing?

Ok got it. Had circular dependencies!

there is no circular dependency. FStructB() is not a declaration (no semicolon).

That was only pseudo code - in my actual code there is not such syntax error.

It seems the problem was that a.h was including b.h and b.h was including a.h - so a circular dependency

well the whole point with a compilation error is that the program is not well formed so even one wrong symbol can be the culprit, pseudo code really doesn’t help in that case. Just as a reminder for next time.

1 Like