I happen to have a situation where there’s 3 Public and Private DependencyModuleNames with comment stating which PublicDependencyModuleNames is for the game, plugin etc
In .build.cs
PublicDependencyModuleNames.AddRange(new string { SlateCore});
PublicDependencyModuleNames.AddRange(new string { });
PublicDependencyModuleNames.AddRange(new string { });
PrivateDependencyModuleNames.AddRange(new string {Slate });
PrivateDependencyModuleNames.AddRange(new string { });
PrivateDependencyModuleNames.AddRange(new string { });
and each has different modules for different parts of the project
and I have
error LNK2019: unresolved external symbol “__declspec(dllimport) public: static class ISlateStyle const & __cdecl ::Get(void)” (_imp?Get@@@SAAEBVISlateStyle@@anonymous_user_9674a66c) referenced in function “public: virtual void __cdecl MyClass::CustomizeDetails(class IDetailLayoutBuilder &)” (?CustomizeDetails@MyClass@@UEAAXAEAVIDetailLayoutBuilder@@@Z)
I also tried to have both of them in public and in private but it didnt work
so how does unreal engine knows that the second one should be for the plugin and the third one for the game
I am open to someone correcting me if I’m wrong, but basically you’re always building the project.
A plugin is just dependency code for the project being built
So ultimately, UE build doesn’t care, it just gathers all the modules it needs to load (which it find by reading all the included build.cs files) and compiles them.
A module is the same whether it’s stated in the plugin build or the project build, so it will be included either way
This in most cases means you have the declaration(the .h file) but not the definition (the .cpp file) so check out why the module is included and not linked.
This can happen if the module does not allow you to use it (it didn’t expose the method) or it’s a private module or something similar