LNK2019 GetPrivateStaticClass error on my own class?

I have defined a class like the following in ParseUser.h:

UCLASS()
class PARSEPLUGIN_API UParseUser : public UParseObject
{
	GENERATED_UCLASS_BODY()

My intent is to expose all of the class’ functions through the plugin’s API by decorating the class definition like so, rather than having to add PARSEPLUGIN_API to every function in the class. Unfortunately, doing so throws this error:

Module.ParsePlugin.cpp.obj : error LNK2019: unresolved external symbol "public: static class UClass * __cdecl UParseUser::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UParseUser@@SAPEAVUClass@@PEB_W@Z) referenced in function "public: static void * __cdecl UParseUser::operator new(unsigned __int64,class UObject *,class FName,enum EObjectFlags)" (??2UParseUser@@SAPEAX_KPEAVUObject@@VFName@@W4EObjectFlags@@@Z)

Now I am most likely doing this completely wrong, because upon looking up this error in the forums I see others have run into the same problem…but it was intentional, like a feature not exposed by Epic. Could someone point me in the right direction to resolve this link error?

The code above looks OK. I’m going to take a guess and say that your ParsePlugin module is missing a line inside one of it’s private .cpp files that includes the “ParsePlugin.generated.inl” file, which contains the generated code that implements GetPrivateStaticClass for your class.

–Mike

Thank you! This was indeed the issue. I actually had it in a header file (ParsePluginPrivatePCH.h), but moved it over to ParsePlugin.cpp and now it compiles successfully. Thanks again!

Hi William,

Did you generate this by using File / Add Code to Project in the editor? That’s usually how I add new Unreal classes (though I still add non-Unreal ones manually). If not, maybe try that if it’s possible?