How to use free functions present in a plugin, in my current game project?

Hello,

I have a plugin which has a free functions declared in a header file and defined in a cpp file.

The header file is present in Classes folder and cpp file is in private folder.

When i try to use this free function in my game project, it is giving me this linker error:

>MyActor.cpp.obj : error LNK2019: unresolved external symbol "void __cdecl Something(void)" (?Something@@YAXXZ) referenced in function "public: virtual void __cdecl AMyActor::OnConstruction(struct FTransform const &)" (?OnConstruction@AMyActor@@UEAAXAEBUFTransform@@@Z)

If i declare and define the free function inside the header file, then, it works, but if i separate it, it gives me that linker error.

Please help.

Thank you!

Have you got the plugin in your build.cs dependancies?

Thank you, DarkwindRichard.

I forgot to add MyModulename_API macro in my free function.

Yes, i have included it in my build.cs like this

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

Do you also have the corresponding API macro attached to your function so that it looks something like this?

void TESTPLUGIN_API Something()