Download

Trying to include Plugin creates a LNK2019 error when starting up in Unreal Editor

Hello,
im struggling to include C++ classes from external libarys/plugins.
I created a new plugin using the editor system.
then i added a new class to the plugin, which i want to use in my project.

I followed a tutorial and changed
PluginTest1.uplugin

to Type runtime, since i want to use it always.

My PluginTestProject1.Build looks like this:

Now things gets pretty strange.
–I can compile the project together with the plugin in Visual Studio without probs. no errors whatssoever. i can even start the “Debug GameEditor” mode from UnrealVS,
loading up the Unreal Editor and it works !
–But i cant start PluginTestProject1.uproject directly, since it trys to create both dlls (project + plugin dlls). It gives a LNK2019 error from the function, where i use my class from the plugin (it works in Visual Studio).

So i think the Problem comes from the UnrealBuildEngine, which i find hard to understand since i dont have any exprience with it. So far i know he can include the header files, but fails to link to the created .dll from the plugin.

im not sure if it has to be:
PrivateDependencyModuleNames.AddRange(new string] { “PluginTest1” });
or
PublicDependencyModuleNames.AddRange(new string] { “PluginTest1” });


or if have to add any other command. Im wondering about this because i added the plugin and the class using the unreal editor correctly. (Yes i added the plugin class by choosing the pluginruntime correctly).

Any Ideas, Tutorials or something … im rly sinking time into this… and i want to strat using unreal engine :smiley:

Thanks for ur help

Since i also had a LNK2019 yesterday, here’s what i did:

Delete the Intermediate folder
Generate Project files again
Compile
Be happy :slight_smile:

Explanation: Sometimes there are old obj files in the intermediate folder which cause this error. Or so i read somewhere.

Took me about 4 hrs until i figured that out…

@epic Even with aunty google it took too long to find this out. Is there somewhere a sticky with such oddities? I mean, the source was perfectly fine, it just refused to link due to not recompiling stuff.

  • Algorithman

Thank u for ur answer :slight_smile: Its working for me aswell.

I delted the projectsettings first but it didnt work, then i looked more into it and delete the intermediate folder inside the pluginfolder aswell and that did the job :slight_smile:
Do u still know where do u read it ? I would like rly to get some more info about the plugin system/buildsystem of unreal, since its steal laking…

Thank u again !:slight_smile:

No, sorry. It was not on the first page of search results tho. I look into it again this evening, if i find it, i’ll tell you.

And you’re welcome :slight_smile:

u dont have to :slight_smile:
Would just have been handy.

thanks

the unrealengine build system is really strange… i edited my code in VS and when i next time strated the normal unreal project it crashed because of something i fixed in VS already.

i tried to delete the interdimated folders again but it didnt help. so i delte the binaries and tada now it would recrate a dll and start the project properly . I think i put my code into the gameplayclass which gets loaded on startup and caused an exception. I did that so i could debug faster in Visual Studio.

I think hot reloading / compiling the C++ stuff would have fixed it, but i dont know if there is a way outside the editor.

Is there a build version in VC like DebugGameEditor, where i can manually compile the C++ stuff ? Would be handy to catch errors aswell.