hi, im trying to make a function but i get these errors:
C4430: missing type specifier - int assumed. Note: C++ does not support default int
and error
C4508: ‘Test’: function should return a value; ‘void’ return type assumed
this is my header file
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "GamePadFunctions.generated.h"
/**
*
*/
UCLASS()
class BUTTONCLICK_API UGamePadFunctions : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
UFUNCTION(BlueprintCallable, Category = "Test")
void Test();
};
this is my cpp file
#include "../Public/GamePadFunctions.h"
Test()
{
}
thanks in advance,
Steve_Robb
(Steve_Robb)
2
Hi,
You don’t say which lines the errors occur on, but my guess is that it’s because your constructor definition in the .cpp file should be:
void UGamePadFunctions::Test()
{
}
Steve
hi,
thanks that worked, maybe a stupid question but im new to c++ do you always need to UGamePadFunctions:: for calling a function?
Thanks in advance,
Steve_Robb
(Steve_Robb)
4
To call a member function of a class, you will need a pointer to an instance of that class.
If you haven’t programmed C++ before, I would suggest following some tutorials before diving into UE4.
Try here: C++ Language - C++ Tutorials
And then here: Introduction to C++ Programming in UE4 | Unreal Engine Documentation
Hope this helps,
Steve