Cant inherit from my interface

ive got an interface ill call MyInterace, and an Actor ill call MyActor, ive inherited the interface like this.
class FIRSTUNREALPROJECT_API AMyActor : public AActor, public IMyInterface
for some reason, this isnt compiling, and ive included the include. these are the errors im getting.

Error (active)	E1455	member function declared with 'override' does not override a base class member	FirstUnrealproject	D:\UE_5.4\Engine\Source\Runtime\Core\Public\Serialization\ArchiveProxy.h	157```

|Severity|Code|Description|Project|File|Line|Suppression State|Details|
|---|---|---|---|---|---|---|---|
|Error (active)|E1455|member function declared with 'override' does not override a base class member|FirstUnrealproject|D:\UE_5.4\Engine\Source\Runtime\Core\Public\Serialization\ArchiveProxy.h|167|||```

|Severity|Code|Description|Project|File|Line|Suppression State|Details|
|---|---|---|---|---|---|---|---|
|Error (active)|E0020|identifier FTextureBuildSettings is undefined|FirstUnrealproject|D:\UE_5.4\Engine\Source\Runtime\Engine\Classes\Engine\Texture.h|2017|||

|Severity|Code|Description|Project|File|Line|Suppression State|Details|
|---|---|---|---|---|---|---|---|
|Error|MSB3073|The command D:\UE_5.4\Engine\Build\BatchFiles\Build.bat FirstUnrealprojectEditor Win64 Development -Project=D:\Fork-GitStuff\FirstUnrealproject\FirstUnrealproject.uproject -WaitMutex -FromMsBuild -architecture=x64 exited with code 6.|FirstUnrealproject|C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets|44|||

Any help would be appreciated, as I’m stumped!

edit: after compiling in editor, another error im getting is IMyInterface is undefined. im really unsure on this as i have defined it?

The error mentions that the method in the base class does not contain the method you are trying to override.

The error also mentions FTextureBuildSettings as an unkown class
add TextureCompressor module into your build file and add the include
#include "TextureCompressorModule.h" if you need it.

Posting the interface and implementing class code would help.

Also make sure you are compiling your project (try right clicking it in the IDE and choosing build)

ArchiveProxy errors usually mean you are trying to compile the binary version of the engine

If the engine is set to default project then right click you project game name and pick set as default startup project.

adding TextureCompressureModule fixed that issue, changing to build seem to give me errors as im using the unreal build tool.dll. im not sure what to do on the default build issue, as im not sure what im supposed to be right clicking. im now getting these 2 errors ```Severity Code Description Project File Line Suppression State Details
Error C2504 ‘IMyVisitor’: base class undefined FirstUnrealproject D:\Fork-GitStuff\FirstUnrealproject\Source\FirstUnrealproject\Public\NavGraph.h 12

Severity Code Description Project File Line Suppression State Details
Error C3668 ‘ANavGraph::_getUObject’: method with override specifier ‘override’ did not override any base class methods FirstUnrealproject D:\Fork-GitStuff\FirstUnrealproject\Source\FirstUnrealproject\Public\NavGraph.h 14
Here is the interface code ``` #pragma once

#include "CoreMinimal.h"
#include "DynamicObstacle.h"
#include "UObject/Interface.h"
#include "MyVisitor.generated.h"

// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UMyVisitor : public UInterface
{
	GENERATED_BODY()
};

/**
 * 
 */
class FIRSTUNREALPROJECT_API IMyVisitor
{
	GENERATED_BODY()

	// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:
	//virtual void Visit(UDynamicObstacle& dynamicObstacle);

};

here is the implement code, though most of it i think is irrelevant to the problem ``` pragma once

include “CoreMinimal.h”
include “Interfaces\MyVisitor.h”
include “GameFramework/Actor.h”
include “NavGraph.generated.h”
using namespace std;

UCLASS()
class FIRSTUNREALPROJECT_API ANavGraph : public AActor, public IMyVisitor
{
GENERATED_BODY()

public:

//void Visit(UDynamicObstacle& dynamicObstacle) override;
enum GridCanContain { Empty, Obstacle, Enemy, Player };
// Sets default values for this actor's properties
ANavGraph();

static ANavGraph* instance;

struct GridSquare {
	FVector startPoint;
	FVector endPointX;
	FVector endPointY;
	float cellSize;
	FVector Center;
	GridCanContain contains;

	GridSquare(FVector InStartPoint = FVector(0,0,0), float InCellSize = 0)
		: startPoint(InStartPoint),
		endPointX(FVector(InStartPoint.X + InCellSize, InStartPoint.Y, InStartPoint.Z)),
		endPointY(FVector(InStartPoint.X, InStartPoint.Y + InCellSize, InStartPoint.Z)),
		cellSize(InCellSize),
		Center(FVector(startPoint.X + (cellSize / 2), startPoint.Y + (cellSize / 2), startPoint.Z + (cellSize / 2))) {}

};
virtual void BeginDestroy() override;

protected:

// Called when the game starts or when spawned
virtual void BeginPlay() override;

private:

FVector DefineSquareBounds(float baseX, float baseY, float baseZ);

GridSquare*** Grid = nullptr;

GridSquare*** CreateGrid();

void AddRow(int height, int column);

void AddColumn(int height);

GridCanContain SquareContains(FVector boxCenter, float cellSize);

void DoesCubeContainStaticActor(bool& bHit, const FVector& boxCenter, float cellSize, TArray<TEnumAsByte<EObjectTypeQuery>>& ObjectTypesToCheck, TArray<AActor*, FDefaultAllocator>& ActrosToIgnore, TArray<AActor*, FDefaultAllocator>& OverlappedActors);

GridSquare CreateSquare(FVector& start, float cellSize);

void DebugShowObstacle(FVector center);
UPROPERTY(EditAnywhere)
int NumRows;

UPROPERTY(EditAnywhere)
int NumColumns;

UPROPERTY(EditAnywhere)
int NumHeight;

UPROPERTY(EditAnywhere)
float tileSize;

UPROPERTY(EditAnywhere)
float LineThickness;

UPROPERTY(EditAnywhere)
float ObstacleSphereRadius;

UPROPERTY(EditAnywhere) 
float ObstacleSphereDetail;


UPROPERTY(EditAnywhere)
FColor GridColor;

UPROPERTY(EditAnywhere)
FColor ObstacleSphereColor;

UPROPERTY(EditAnywhere)
bool ShowGrid;

UPROPERTY(EditAnywhere)
int LayerPriority;

UFUNCTION()
void DrawDebugGrid(FVector startPosition, int rows, int columns, int gridNum, float cellSize, FColor color, int lifeTime);
void DrawColumns(int totalColumns, FVector& startPosition, float cellSize, int gridNum, int totalRows, FColor& color, int totalGridNum, int lifeTime);
void DrawYAxisZLines(int totalRows, FVector& start, float cellSize, FColor& color, int lifeTime);
bool NotLastGrid(int gridNum, int totalGridNum);
void DrawRows(int totalRows, FVector& startPosition, float cellSize, int gridNum, int totalColumns, FColor& color, int totalGridNum, int lifeTime);
void DrawXAxisZLines(int totalColumns, FVector& start, float cellSize, FColor& color, int lifeTime);

virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChnagedEvent) override;

public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};

thanks for your answer before!

It compiles no problem on my end.

Just had to move the enum and struct definition above the class for it to be accessible in the cpp file.

Can you post an update list of errors?

The function in the interface is marked out as a comment so it’s not even implemented in the class

Though the triple pointer may be causing some instabilities. Not sure why you would need a pointer to a pointer to a pointer.
Just use a matrix at that point (FMatrix struct)

Or multidimensional tarrays

Thanks, I’m new to unreal so I didn’t know matrix was a thing, ill try that out a give an update tomorrow

thanks for the links! as for the errors im getting, i assume you mean the compiler ones, its the same 2 as before.

 Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	C2504	'IMyVisitor': base class undefined	FirstUnrealproject	D:\Fork-GitStuff\FirstUnrealproject\Source\FirstUnrealproject\Public\NavGraph.h	28

and this error

Error	C3668	'ANavGraph::_getUObject': method with override specifier 'override' did not override any base class methods	FirstUnrealproject	D:\Fork-GitStuff\FirstUnrealproject\Source\FirstUnrealproject\Public\NavGraph.h	30

here is a image of the full list


im not sure if it has something to do with me deleting the interface before this? i named it wrong but couldnt figure out how to rename it in editor, and figured that if i was going to do everything by hand, it was easier to delete the cpp and h files, and recreate a new interface with the cirrect name, but this might have caused issues? its the only thing i can think of that might have caused a difference between yours and mine. i have double checked that the includes and all right.
Also i commented out the inherited functions as they were giving me errors as they couldnt find a method to override, and i wanted to compile my project in editor to see if that would fix it. editor compile issues are the same as the IDE ones

It might be an orphaned file in that case saved somewhere in unreal’s redirects.
a) Check that the file was deleted from the drive and not just from the solution explorer.
b) close vs
delete

  • intermediate
  • derivedDataCache
  • binaries
  • .vs
  • saved
    and rebuild the project, this might clear up some problems.

As for the errors IMyvisitor
includes should be like this:
#include “Interfaces/MyVisitor.h”
Perhaps that is causing problems with finding the header path

you were right, the files were still in my recycle bin, unfortunately, doing both 1 and 2 hasn’t fixed it, i have checked and my include is the same as well. I’m really not sure what else could be causing this. Thanks for the help!

Fixed it! heres the post which has the answer c++ - error C2504: base class undefined - Stack Overflow
the issue was that one of my includes was bringing the nav graph class ahead in the compiler than my include in MyVisitor DynamicObject, or at least that was it from what i understood. i just commented that out and now it compiles!. Thanks for your help with this, and the resources will be very helpfull!

Next time put all of the dependent includes in you cpp files and forward declare the variables in the header.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.