Unresolved External symbols from a C++ interface

I am attempting to create a simple interface in C++. I have already defined and declared the virtual function, yet Visual Studio claims that NPC.cpp has unresolved external symbols. Here is the relevant code:

IInteractable.cpp:

#include "IInteractable.h"

void IInteractable::Interact()
{

}

IInteractable.h:

UINTERFACE(MinimalAPI)
class UInteractable : public UInterface
{
	GENERATED_BODY()
};

class ULTRARPG_API IInteractable
{
	GENERATED_BODY()

public:
	FText InteractPrompt;

	virtual void Interact();
};

NPC.h:

public:
	void Interact() override;

NPC.cpp:

void Interact()
{
	UE_LOG(LogTemp, Warning, TEXT("Talk"));
}

Looks like u forgot NPC namespace, like

void ANPC::Interact()
{
	UE_LOG(LogTemp, Warning, TEXT("Talk"));
}
1 Like