Because you are calling a Member function.
In order to call these member functions you must have a class instance to call it.
You can also make UInteract a child of UQuestInteraction or make the function static so that you do not need to call it without a class instance (but you need to know when to use static) .
If you do not know what this means then my suggestion is to study C++ a bit more. These issues are C+±related and not UE4 related.
I’m getting error message C3861 “function” identifier not found which usually means that the function I’m trying to call is out of scope.
My code is something like this (I excluded a lot of the default code for simplicity, but I have everything that UE4 files should fundamentally need):
QuestComponent.h
public:
void QuestInteraction();
QuestComponent.cpp:
void UQuestComponent::QuestInteraction()
{
// code
}
Interact.cpp
#include “QuestComponent.h”
void UInteract::BeginPlay()
{
Super::BeginPlay();
QuestInteraction(); // line 77
}
Compiling this returns:
(line 77): error C3861 “QuestInteraction”: indentifier not found
I checked Microsoft’s website for the explanation of C3861 but it didn’t help. I’ve already tried everything that they recommended.
Thanks in advance!
But if this were a normal program, all I’d have to do is #include the file with the function in it according to Microsoft.
No. If it’s a class non-static member function, you must have an instance of the class in order to call it.
If you do not have experience with C++, I highly recommend learning C++ first before using C++ with Unreal. Or, stick with Blueprints.