<SOLVED> Custom Plugin can be called from Blueprints but can't be called from C++ classes

Hi! I created a custom plugin in C++ for Android that calls native android java libraries and I call the plugin from blueprints without problems. Everything works perfect.

Now I am rewriting most of my blueprints in native C++ and I noticed I can’t call my plugin from C++.

I included the module in my Build.cs file:

PrivateDependencyModuleNames.AddRange(new string[] {"AndroidAPITemplate"});

Then included it in the .h of my Actor:

#include "AndroidAPITemplateFunctions.h"

Finally implemented it in a function:

	UAndroidAPITemplateFunctions::UInitBT();

IDE seems to catch it:

image

but when i compile i get this:

  LNK2019: unresolved external symbol "public: static void __cdecl UAndroidAPITemplateFunctions::UInitBT(void)" (?UInitBT@UAndroidAPITemplateFunctions@@SAXXZ) referenced in function "protected: virtual void __cdecl AMyGameModeCPP::BeginPlay(void)" (?BeginPlay@AMyGameModeCPP@@MEAAXXZ)
  LNK1120: 1 unresolved externals

Any Help?

Your class declaration probably looks like:

class UAndroidAPITemplateFunctions : public ...

You need a module api macro so that it looks like:

class ANDROIDAPITEMPLATE_API UAndroidAPITemplateFunctions : public ...

so that the class data is included in the dll linkage information.

1 Like

THANKS!!! This solved the problem :slight_smile: