c++compiler-errorsheaderunreal-engine5unreal-blueprint

I created this new blueprint function library and made a simple function named getpointlessmessage but it doesnt pop up when is search for it in BP


he is my code for the header file

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once
#include "UObject/Object.h"
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "MyBlueprintFunctionLibrary.generated.h"



UCLASS()
class MYPROJECT2_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
public:

    UFUNCTION(BlueprintCallable);
    static FString GetPointlessMessage();
protected:

private:
    GENERATED_BODY()
    
};

here is my code for the cpp file

// Fill out your copyright notice in the Description page of Project Settings.


#include "MyBlueprintFunctionLibrary.h"

FString UMyBlueprintFunctionLibrary::GetPointlessMessage()
{
    return FString(TEXT("Hi guys"));
}

their are no other errors other than the regular intelliscence errors but if you want to see them here are they

enter image description here

I tried to debug and run the code nothing poped up i also made sure i was in devolopment editor mode so if some one can help me it would be great

what i did was run from visual studio after saving, I opened the blueprint file of the level and searched for pointless and couldnt find any thing i also searched for the whole name getpointlessmessage still found nothing! enter image description here


Solution

  • Had to remove two things the ; in UFUNCTION and had to remove TEXT from the cpp file in the return

    that fixed everything and it works now!!!!

    // Fill out your copyright notice in the Description page of Project Settings.
    
    #pragma once
    #include "UObject/Object.h"
    #include "CoreMinimal.h"
    #include "Kismet/BlueprintFunctionLibrary.h"
    #include "MyBlueprintFunctionLibrary.generated.h"
    
    
    
    UCLASS()
    class MYPROJECT2_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
    {
    public:
    
        UFUNCTION(BlueprintCallable)
        static FString GetPointlessMessage();
    protected:
    
    private:
        GENERATED_BODY()
    };
    

    cpp file

    // Fill out your copyright notice in the Description page of Project Settings.
    
    #include "MyBlueprintFunctionLibrary.h"
    
    FString UMyBlueprintFunctionLibrary::GetPointlessMessage()
    {
        return FString(("Hi guys"));
    }