Plugin attempt, getting LNK2019 making simple function

Hey guys. I guess it’s probably abnormal for a dev to post in here, but I am not a programmer and it’s too late to bug anybody at the office so here goes.

I am trying to make a Plugin that adds a blueprint node. For now I am starting super-small and basically copying an existing node “GetCharacterArrayFromString” (that will be in 4.3 but not 4.2).

I followed the tutorial here: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums
As well as copied some basic structure from the MathExpression plugin.

I get the following error on compile:

Error 1 error LNK2019: unresolved external symbol “public: __cdecl ULsystemClasses::ULsystemClasses(class FPostConstructInitializeProperties const &)” (??0ULsystemClasses@@QEAA@AEBVFPostConstructInitializeProperties@@@Z) referenced in function “void __cdecl InternalConstructor(class FPostConstructInitializeProperties const &)” (??$InternalConstructor@VULsystemClasses@@@@YAXAEBVFPostConstructInitializeProperties@@@Z) J:\Build\UE4\Engine\Intermediate\ProjectFiles\LsystemLibrary.generated.cpp.obj LsystemTest

I have a .h file inside of the \Classes directory. LsystemClasses.h It contains:

#pragma once

#include "LsystemClasses.generated.h"


UCLASS()
class ULsystemClasses : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()
public:
	UFUNCTION(BlueprintPure, Category="Utilities|String")
	static TArray<FString> LsystemParseTest(const FString& SourceString);
};

And the main .cpp is called LsystemLibrary.cpp:

#include "LsystemLibraryPrivatePCH.h"
#include "LsystemClasses.h"



TArray<FString> ULsystemClasses::LsystemParseTest(const FString& SourceString)
{
	TArray<FString> SeparatedChars;

	if (!SourceString.IsEmpty())
	{
		for (auto CharIt(SourceString.CreateConstIterator()); CharIt; ++CharIt)
		{
			TCHAR Char = *CharIt;
			SeparatedChars.Add(FString(1, &Char));
		}

		// Remove the null terminator on the end
		SeparatedChars.RemoveAt(SeparatedChars.Num() - 1, 1);
	}

	return SeparatedChars;
}

When I had the .cpp with an exact copy of the mathexpressions code it was working. I could load the editor, check my plugin, and then see a duplicate MathExpression node in the BP editor (renamed to “Lsystem Test node”)

For some reason now when I try to copy the functionality of a far simpler node, it fails.

I have looked at the various other LNK2019 threads and it seems like a fairly common issue, but in the other cases it was usually an include missing or private function that needed access or something. In this case, the function is being declared right there in the .h file so I am wondering what I am doing wrong.

My PCH file contains the following headers (the BP stuff probably isn’t necessary but removing it did not help)

#include "LsystemLibrary.h"
#include "UnrealEd.h"
#include "LsystemLibraryPlugin.h"
#include "BlueprintGraphClasses.h"
#include "LsystemClasses.h"

Any help will be immensely appreciated :slight_smile:

Hi! I had a similar problem only a few hours ago. It appears that UObject derived classes need to provide an implementation for a constructor (even a trivial one), and even if you didn’t declare one in the header file.

Try adding the following to the cpp file and see if the problem gets resolved.

ULsystemClasses::ULsystemClasses(const class FPostConstructInitializeProperties &PCIP) : Super(PCIP)
{

}
1 Like

Wow, you were spot on with that!!!
Thanks a bunch. I will pass this on to some people around here in case it isn’t widely known.

10136-capture.png

Node works now :slight_smile: