In the past I’ve used plain .h files - no class or anything - to store groups of enums and structs and the likes to be used in various files. I’m trying to do that here in 4.10, but I can’t get it to compile.
The specific line of code is simply FVector Location;
Yet when I compile, I get error C3646: 'FVector': unknown override specifier
I have #include "Runtime/Core/Public/Math/Vector.h" at the top of the file, and IntelliSense picks up what an FVector is. What am I doing wrong here??
EDIT: I found the culprit: upon making a new class inside UE4 (this time of the Object type), I get rid of everything but #pragma once. This includes the line #include "class.generated.h". Therein the error lies:
When I keep that line included, everything works again, even without including Vector.h.
Out of curiosity, what is the purpose of this line? What does the generated.h header do?
I can’t replicate the error. Where is that header file and where is it getting included? I’m assuming the line “FVector Location;” is in a struct, right?
I tried to replicate it and found that the problem was with me getting rid of my generated.h line. Whoops! And that is the header file provided in the documentation for FVectors, and I included it in my .h file.
The xxx.generated.h is used for files/classes that derive from UObject. It’s part of making all those crazy macros like (GENERATED_BODY() work. It’s also part of their precomputed header system. If you use the class wizard and derive from “None” instead, you don’t need it (and still able to use FVector). However, instead of using a class wizard to create a header file that will only have enums and structs that don’t interact with Unreal’s systems, you can just create a text file in the same folder as the files that will include it.