Error c++ worked in 4.16

Hi,

what is wrong with my code? it worked in UE4.16

errors:
GamePadFunctions.gen.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) class UClass * __cdecl Z_Construct_UClass_UButton_NoRegister(void)” (_imp?Z_Construct_UClass_UButton_NoRegister@@YAPEAVUClass@@XZ) referenced in function “class UFunction * __cdecl Z_Construct_UFunction_UGamePadFunctions_GamePadClick(void)” (?Z_Construct_UFunction_UGamePadFunctions_GamePadClick@@YAPEAVUFunction@@XZ)

C:\Program Files (x86)\Epic Games\UE_4.18\UMGGamePadSupport\Binaries\Win64\UE4Editor-UMGGamePadSupport-9512.dll : fatal error LNK1120: 1 unresolved externals

header file:

GENERATED_BODY()

UFUNCTION(BlueprintCallable, Category="GamePad Functions")
static void GamePadClick(UButton* btn);

UFUNCTION(BlueprintCallable, Category="GamePad Functions")
static void GamePadHover(UButton* btn);

cpp file:

void UGamePadFunctions::GamePadClick(UButton* btn) {
check(btn);
btn->OnClicked.Broadcast();
}

void UGamePadFunctions::GamePadHover(UButton* btn) {
check(btn);
btn->OnHovered.Broadcast();
}

thanks in advance,

Hey there, it’s a linker error so you probably need an include

#include "Components/Button.h"

Or something like that, so he finds the button definition.

i already have that

http://prntscr.com/i4zce0

http://prntscr.com/i4zcrd

Do you have the “UMG” in the PublicDependencyModuleNames in the Build.cs?

■■■■ it! i forgot that one :slight_smile:
thanks

■■■■ it! i forgot that one :slight_smile:
thanks