UTexture2D identifier is undefined

I’ve been posting to the answerhub a lot these past few days, but I’m still learning c++. My problem is that I’m trying to make a reference to a texture2d that can be altered in blueprints that will be used in a structure, but in my declaration the issue of the identifier being undefined came up (after nearly an hour of ue4 compiling). My code is below:

struct FSourceInput {
		UTexture2D* sourceImage;

		FName Title;

Also, when is it appropriate to use * and &? I use one and the compiler expects the other

You need to forward declare the class like this:

class UTexture2D* sourceImage;

or put class UTexture2D; before the struct. Then in cpp file that gonna use this struct you include “Engine/Texture2D.h”.

Normally you would do include in header file and that it, but this convention of using forward declarations in entire UE4 prevents circular references to occur. you can read about it more here: