1

I'm following a Packt tutorial regarding CSV table entry. The tutorial requires that I a) create a new Actor class, b) name it TestCustomData, and c) replace the contents of the newly-generated TestCustomData.h with the following code:

#pragma once

#include "TestCustomData.generated.h"

USTRUCT(BlueprintType)
struct FTestCustomData : public FTableRowBase
{
GENERATED_USTRUCT_BODY()

UPROPERTY( BlueprintReadOnly, Category = "TestCustomData" )
int32 SomeNumber;

UPROPERTY( BlueprintReadOnly, Category = "TestCustomData" )
FString SomeString;
};

However, the TestCustomData file fails to compile, outputting the following log:

Error f:\unreal\ue4 assignments\ue4_projectrpg\source\ue4_projectrpg\TestCustomData.h(5) : error C2504: 'FTableRowBase': base class undefined
Info Compiling game modules for hot reload
Info Parsing headers for UE4_ProjectRPGEditor
Info   Running UnrealHeaderTool "F:\Unreal\UE4 Assignments\UE4_ProjectRPG\UE4_ProjectRPG.uproject" "F:\Unreal\UE4 Assignments\UE4_ProjectRPG\Intermediate\Build\Win64\UE4_ProjectRPGEditor\Development\UE4_ProjectRPGEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Info Reflection code generated for UE4_ProjectRPGEditor in 3.4146568 seconds
Info Performing 4 actions (4 in parallel)
Info TestCustomData.cpp
Info UE4_ProjectRPG.generated.cpp
Error f:\unreal\ue4 assignments\ue4_projectrpg\source\ue4_projectrpg\TestCustomData.h(6) : error C3646: 'Super': unknown override specifier
Error f:\unreal\ue4 assignments\ue4_projectrpg\source\ue4_projectrpg\TestCustomData.h(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error F:\Unreal\UE4 Assignments\UE4_ProjectRPG\Source\UE4_ProjectRPG\TestCustomData.h(5) : error C2504: 'FTableRowBase': base class undefined
Error F:\Unreal\UE4 Assignments\UE4_ProjectRPG\Source\UE4_ProjectRPG\TestCustomData.h(6) : error C3646: 'Super': unknown override specifier
Error F:\Unreal\UE4 Assignments\UE4_ProjectRPG\Source\UE4_ProjectRPG\TestCustomData.h(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Info ERROR: UBT ERROR: Failed to produce item: F:\Unreal\UE4 Assignments\UE4_ProjectRPG\Binaries\Win64\UE4Editor-UE4_ProjectRPG-3031.dll
Info Total build time: 6.88 seconds (Local executor: 0.00 seconds)

I'm fairly new to StackOverflow and C++ in UE4, and any help would be appreciated. Any feedback to improve my question is also welcome! Thanks in advance for your help.

0

3 Answers 3

1

I was stuck at the same spot and this fixed it: I named the Asset "MyActor2" and the Strucure "ThisNewStructure" so there are some little differences...

I think it was basicly including the Datatable.h and the "public:" that did the trick.

Header File:

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Runtime/Engine/Classes/Engine/DataTable.h"
#include "MyActor2.generated.h"

USTRUCT(BlueprintType)
struct FThisNewStructure : public FTableRowBase
{
    GENERATED_USTRUCT_BODY()
public:

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test)
        int32 SomeNumber;
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test)
        FString SomeString;

};

cpp:

#include "MyActor2.h"

Then it compiles successful. I had to do some closing/reopening of VS & UE for the Editor to know about the new structure.

Sign up to request clarification or add additional context in comments.

2 Comments

This didn't work initially, but I've gone back and tweaked it and it seems to compile now. There were several small errors in VS, but no issues in UE4. It's weird - but I'm not complaining. I just wish that the tutorial was clearer - it's hard to troubleshoot without extra help. Thanks.
As far as I understood it might be normal to get Errors when you compile in VS. You should always compile from within UE-Editor.
0

It may be a little late, but I just ran into this myself. Sometimes you'll have an include that automatically grabs the FTableRowBase, but sometimes a class doesn't have a header that calls back to it. In that case:

#pragma once

#include "Engine/DataTable.h"//this is where FTableRowBase is declared.
#include "TestCustomData.generated.h"

struct FFoo : FTableRowBase
{
    GENERATED_USTRUCT_BODY()
    public:
       the rest of your class...

I hope this helps! :D

Comments

0

Thanks for the help, I was working through the same problem in the same tutorial. Apparently you didn't need to rename TestCustomData to MyActor2, you just needed to add the line "public:" after the "GENERATED_USTRUCT_BODY()".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.