IPluginManager::Get() Linker error - Not finding implementation

This is code that’s currently compiling inside a plugin I installed on the engine (so it’s on the engine’s folders).

My file is inside my project folder, instead, under plugin/…
The file is a cpp file that includes the plugin manager, just as the other plugin does.

#include "IPluginManager.h"

When using

IPluginManager::Get().FindPlugin("......

To get the singleton instance of it, I get a compile error everywhere I use IPluginManager’s functions saying that couln’t find Get implementation (cpp). I don’t get other compile errors, so the .h is found. In fact I can go to the code in VS. The erorr is in spanish but basically says it’s not resolved.

error LNK2019: simbolo externo "__declspec(dllimport) public: static class IPluginManager & __cdecl     IPluginManager::Get(void)" (__imp_?Get@IPluginManager@@SAAEAV1@XZ) sin resolver al que se hace referencia en la funcion "private: static class FString __cdecl  FXXXXXToolStyle::InContent(class FString const &,char const *)" (?InContent@FXXXXToolStyle@@CA?AVFString@@AEBV2@PEBD@Z)

Something wrong I’m doing?

1 Like

I found the answer in the most unexpected place.

In order to access the
IPluginManager.h header file you need
to add the “Projects” dependency on
your plugin’s dependencies

That means opening the xxxx.build.cs and adding to Private dependencies “Projects” on the list.
In fact, including Interfaces/IPluginManager.h is more common than just IPluginManager.

10 Likes

Yes,when I added the “Projects” dependency on my plugin’s dependencies ,it was right.

I added Projects in cs, still link error

To use IPluginManager::Get() you must called in static function eg:

in header:

class Class{
static void Definition();
};

in cpp:
void Class::Definition(){ IPluginManager::Get().//Do something }

To remove all doubt as to what this is saying to do:

  1. Open your Plugin PLUGIN_NAME.Build.cs file
  2. Add “Projects” to PrivateDependencyModuleNames
  • e.g., PrivateDependencyModuleNames.AddRange(new string[] { "Projects" });
  • Note: You may have additional strings in PrivateDependencyModuleNames depending on your project.

Why PublicDependencyModuleNames and not PrivateDependencyModuleNames?.. Well it depends so read this other forum post.