UFUNCTION causing error

I dont understand what is going on. I just created a new Character Class nothing is added into it if I compile everything works fine as usual but the moment I add a UFUNCTION I cannot compile cause of this error:

---------- Creating patch ----------
Running F:\EpicGames\UE_5.1\Engine\Build\BatchFiles\Build.bat -Target=“zProjectEditor Win64 Development -Project=”“F:/UnrealEngine/zProject/zProject.uproject”“” -LiveCoding -LiveCodingModules=“F:/EpicGames/UE_5.1/Engine/Intermediate/LiveCodingModules.txt” -LiveCodingManifest=“F:/EpicGames/UE_5.1/Engine/Intermediate/LiveCoding.json” -WaitMutex -LiveCodingLimit=100
Running UnrealBuildTool: dotnet “…..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” -Target=“zProjectEditor Win64 Development -Project=”“F:/UnrealEngine/zProject/zProject.uproject”“” -LiveCoding -LiveCodingModules=“F:/EpicGames/UE_5.1/Engine/Intermediate/LiveCodingModules.txt” -LiveCodingManifest=“F:/EpicGames/UE_5.1/Engine/Intermediate/LiveCoding.json” -WaitMutex -LiveCodingLimit=100
Log file: C:\Users\jay2j\AppData\Local\UnrealBuildTool\Log.txt
Invalidating makefile for zProjectEditor (working set of source files changed)
Parsing headers for zProjectEditor
Running Internal UnrealHeaderTool F:\UnrealEngine\zProject\zProject.uproject F:\UnrealEngine\zProject\Intermediate\Build\Win64\zProjectEditor\Development\zProjectEditor.uhtmanifest -WarningsAsErrors -installed
Total of 3 written
Reflection code generated for zProjectEditor in 0.8851401 seconds
Building zProjectEditor…
Using Visual Studio 2022 14.33.31631 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629) and Windows 10.0.26100.0 SDK (C:\Program Files (x86)\Windows Kits\10).
Determining max actions to execute in parallel (8 physical cores, 16 logical cores)
Executing up to 8 processes, one per physical core
Building 3 actions with 3 processes…
[1/3] Compile zProject.init.gen.cpp
[2/3] Compile NPC_Character.gen.cpp
[3/3] Compile NPC_Character.cpp
Total time in Parallel executor: 0.75 seconds
Total execution time: 3.33 seconds
File F:\UnrealEngine\zProject\Intermediate\Build\Win64\UnrealEditor\Development\zProject\NPC_Character.gen.cpp.obj was modified or is new
File F:\UnrealEngine\zProject\Intermediate\Build\Win64\UnrealEditor\Development\zProject\zProject.init.gen.cpp.obj was modified or is new
File F:\UnrealEngine\zProject\Intermediate\Build\Win64\UnrealEditor\Development\zProject\NPC_Character.cpp.obj was modified or is new
Building patch from 3 file(s) for Live coding module F:\UnrealEngine\zProject\Binaries\Win64\UnrealEditor-zProject.dll
Creating library F:\UnrealEngine\zProject\Binaries\Win64\UnrealEditor-zProject.patch_2.lib and object F:\UnrealEngine\zProject\Binaries\Win64\UnrealEditor-zProject.patch_2.exp
NPC_Character.gen.cpp.obj : error LNK2019: unresolved external symbol “public: void __cdecl ANPC_Character::functionproblem(void)” (?functionproblem@ANPC_Character@@QEAAXXZ) referenced in function “public: static void __cdecl ANPC_Character::execfunctionproblem(class UObject *,struct FFrame &,void * const)” (?execfunctionproblem@ANPC_Character@@SAXPEAVUObject@@AEAUFFrame@@QEAX@Z)
F:\UnrealEngine\zProject\Binaries\Win64\UnrealEditor-zProject.patch_2.exe : fatal error LNK1120: 1 unresolved externals
Failed to link patch (0.000s) (Exit code: 0x460)
---------- Finished (0.000s) ----------

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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "NPC_Character.generated.h"

UCLASS()
class ZPROJECT_API ANPC_Character : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	ANPC_Character();

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

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

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

	UFUNCTION(BlueprintCallable)
	void functionproblem();

};

if I remove the UFUNCTION it compiles fine but not if it is there.

Edit:It does this error for every class not just for CharacterClass…

Did you implement the function in the .cpp file? I think you have to implement them if it’s a UFUNCTION (for everything except BlueprintImplementableEvent).

Also I would recommend closing the editor and compiling from your IDE when changing header files. Live coding is more reliable with only .cpp changes

1 Like

didnt have to close the editor it was just because I didnt Implemented it. thank you !

1 Like

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