Linker error LNK2019 C++ UE4

Linker gives me 3 errors:

2>MazeLib.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl TStack<class FString>::TStack<class FString>(int)" (??0?$TStack@VFString@@@@QEAA@H@Z) referenced in function "void __cdecl testStack(void)" (?testStack@@YAXXZ)
2>MazeLib.cpp.obj : error LNK2019: unresolved external symbol "public: class FString __cdecl TStack<class FString>::pop(void)" (?pop@?$TStack@VFString@@@@QEAA?AVFString@@XZ) referenced in function "void __cdecl testStack(void)" (?testStack@@YAXXZ)
2>MazeLib.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl TStack<class FString>::push(class FString)" (?push@?$TStack@VFString@@@@QEAA_NVFString@@@Z) referenced in function "void __cdecl testStack(void)" (?testStack@@YAXXZ)

My TStack.h file is here:

template<typename T>
class SOMETHING_API TStack
{
public:
	TStack(int size);
	~TStack();
	T pop();
	bool push(T elem);
	bool isEmptY();
	bool isFull();

private:
	T * stack;
	int currPoint = -1, countElems = 0, stackSize;
};

And testStack() function:

void testStack() {
	TStack<FString>* stack = new TStack<FString>(3);
	stack->push(TEXT("1st string!"));
	stack->push(TEXT("2nd string!"));
	stack->push(TEXT("3rd string!"));
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, stack->pop());
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, stack->pop());
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, stack->pop());
}

So can you help me?

1 Like

Help, please!