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@@anonymous_user_9674a66c) referenced in function “class UFunction * __cdecl Z_Construct_UFunction_UGamePadFunctions_GamePadClick(void)” (?Z_Construct_UFunction_UGamePadFunctions_GamePadClick@@YAPEAVUFunction@@anonymous_user_9674a66c)

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

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