I decided to include all my widely-used enums and structs in my project header file (MySaga.h in my case).
Now, these all worked and compiled when they were in my custom actor component class, and all I did was copy/paste–there shouldn’t be any sort of syntax error. Yes, I checked and made sure I copied everything, lol.
But, this struct causes my project to not compile:
/** Used for structuring the data table which will hold all information pertaining to races */
USTRUCT(BlueprintType)
struct FRaceDataStructure : public FTableRowBase
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") FString RaceName = "";
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") FString RaceDescription = "";
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int BonusHitDice = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int BonusStrength = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int BonusDexterity = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int BonusConstitution = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int BonusIntelligence = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int BonusWisdom = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int BonusCharisma = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int BaseMovementSpeed = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int MinimumAge = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int MaximumAge = 9999;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") ECharacterAlignment PreferredAlignment = ECharacterAlignment::RA_NoAlignment;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") ECharacterSize RaceSize = ECharacterSize::RS_NoSize;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int MinimumHeight = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") int MaximumHeight = 9999;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") ECharacterLanguage RacialLanguage = ECharacterLanguage::RL_None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, category = "Race Settings") UMaterial* RaceMaterial;
//TODO Create TArray<> to house character ability bonuses for data table structure.
};
FYI, the enums are all declared above this, and they compile fine.
However, when trying to compile with this, I get the following errors:
Error C:\Users\Bryant\Documents\Unreal Projects\MySaga\Source\MySaga\MySaga.h(66) : error C3646: 'FString': unknown override specifier
Error C:\Users\Bryant\Documents\Unreal Projects\MySaga\Source\MySaga\MySaga.h(66) : error C3646: 'RaceName': unknown override specifier
Error C:\Users\Bryant\Documents\Unreal Projects\MySaga\Source\MySaga\MySaga.h(66) : error C2059: syntax error: '='
Error C:\Users\Bryant\Documents\Unreal Projects\MySaga\Source\MySaga\MySaga.h(66) : error C2238: unexpected token(s) preceding ';'
NOTES:
If I comment out line 66, it throws the same error with FString RaceDescription in line 67.
If I comment out both FString’s (lines 66 & 67), I get the following errors:
Error C:\Users\Bryant\Documents\Unreal Projects\MySaga\Source\MySaga\MySaga.h(68) : error C2144: syntax error: 'int' should be preceded by ';'
Error C:\Users\Bryant\Documents\Unreal Projects\MySaga\Source\MySaga\MySaga.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
I’m totally lost, not only by the meaning of the error, but why this would cause an error in the first place… doesn’t including these sorts of widely used structs/enums in the project’s main header file make sense? Is it not common practice??