Linking error on one function. Header is included.

When I try to call UAnimMontage::HasValidSlotSetup() with my instance of the UAnimMontage class I get a linking error. Every other function in the UAnimMontage class works for me that I’ve tried and I have the appropriate header included and it’s module is engine so it’s in my build file. I’m also getting this error “The command 'D:/UE_5.0/Engine/Build/BatchFiles/Build.bat MyProject2Editor Win64 DebudGame -Projects=D:/UE_5.0/UnrealProjects/MyProject2/MyProject2.uproject -WaitMutex -FromMsBuild exited with code 6” only when I call that function. Thought it was maybe cause I was using visual studio 2022 and not 2019 so I installed 2019 and am now using that. Now I’m getting another error with the 2019 version “Incomplete type is not allowed” in BasicLayoutWidgetSlot.h and SlotBase.h. I read another post here with a similar linking error on just one function and it looked like the issue was that the code in the engine wasn’t prefaced with ENGINE_API. Looked at the source for the UAnimMontage class and this function doesn’t have that preface so I’m wondering if that’s the issue but I’m not sure. I have no idea on the other two errors. Any help would be appreciated. Thanks!