Link error on regular constructor

I’m trying to add a new actor, inheriting from a class called ABaseNineSliceActor. I already have 10 or so other classes inheriting from this class just fine.

In the new class, called AFixedWindow, I’m trying to define the constructor, so I can initialize the components it needs. Basic stuff. However, for an unknown reason I’m now getting a link error stating that the constructor has already been defined. It must be in the generated code, since there are no other mentions of the class name in the solution. I get the same problem when I make a new empty class with a different name - I’m at a loss here.

I attempted just leaving the constructor for what it is and creating the component at runtime using NewObject<>, RegisterComponent() and AttachComponent(), but querying the component in a subsequent call throws an access violation (even IsValid() throws an access violation, kind of defeating its point).


#pragma once

#include "BaseNineSliceActor.h"
#include "FixedWindow.generated.h"

class PROJECT_API AFixedWindow : public ABaseNineSliceActor



#include "Project.h"
#include "FixedWindow.h"



So… help?

Hi there,

The code you have here is basically an empty class template, so there must not be any issues with it. Have you tried the nuclear option? :smiley: Very often such erratic compiler behaviors get fixed by simply regenerating and rebuilding your Visual Studio solution. Please refer to my answer here where I explain how to do this.

Hope this helps :slight_smile:

Just added the classes again, and after another nonsensical error about the .generated file not existing, it decided to start working after all. I already tried removing and adding the classes back several times before, I changed nothing (because the code was already correct).

At least it works now, though a couple of hours have gone down the drain.