Cannot Use Variable Declared in Header

I know I have to be overlooking something simple here but I cannot use any variable or tarray declared in a header in the corresponding cpp. I created a new class to handle some computations and when I call it I get an Access Violation Writing Location error. I’ve tried to compare it to the rest of my classes and cannot figure out what I have left out. I have also cleaned and rebuilt the project. Can anyone point out what I am missing?

Here is the Header:

#pragma once
#include "GameFramework/Actor.h"
#include "EnumClass.h"
#include "BuildingListClass.generated.h"

UCLASS()
class THEBUILDING_API ABuildingListClass : public AActor
{
	GENERATED_BODY()
public:
	ABuildingListClass();
		
		int16 MyLoop;

cpp:

#include "TheBuilding.h"
#include "TheBuildingGameMode.h"
#include "EnumClass.h"
#include "BuildingListClass.h"

ABuildingListClass::ABuildingListClass()
	: Super()
{
}
void ABuildingListClass::TestClass()
{
	MyLoop = 0;
}

Have you tried using an int32 instead? I haven’t had much success using any other ints in the engine.

Unfortunately it does not matter what I declare the int to be. It still will not work in the cpp.

int16 should work, UE4 reflection system does not support it (only supports int32 and uint8), but as long as you don’t use UPROPERTY() on it it should work without problem.

How do you declare TestClass()?
Also check logs, and try rebuilding, sometimes there linking problems.

I was ripping my hair out a couple time because The variable wasn’t being recognized and it ended up being an issue with VS and simple restarting VS solved it

Test Class is declared as:

void TestClass();

and I call it by declaring this variable.

UPROPERTY()
TSubclassOf BDesign;

and the specific call is:

BDesign->GetClass();