# UTexture2D identifier is undefined

**URL:** <https://forums.unrealengine.com/t/utexture2d-identifier-is-undefined/454452>\
**Category:** Asset Creation\
**Tags:** unreal-engine, pointer, UE4, CPP, question\
**Created:** [August 26, 2019, 9:31pm UTC](https://forums.unrealengine.com/t/utexture2d-identifier-is-undefined/454452 "2019-08-26T21:31:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AgentArachnid66](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AgentArachnid66](https://forums.unrealengine.com/u/AgentArachnid66)\
**Post date:** [August 26, 2019, 9:31pm UTC](https://forums.unrealengine.com/t/utexture2d-identifier-is-undefined/454452/1 "2019-08-26T21:31:56Z")

</div>

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:

```
USTRUCT(BlueprintType)
struct FSourceInput {
	GENERATED_USTRUCT_BODY()
	UPROPERTY(BlueprintReadWrite)
		UTexture2D* sourceImage;

	UPROPERTY(BlueprintReadWrite)
		FName Title;
};

```

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

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [August 26, 2019, 10:22pm UTC](https://forums.unrealengine.com/t/utexture2d-identifier-is-undefined/454452/2 "2019-08-26T22:22:25Z")

</div>

You need to forward declare the class like this:

```
UPROPERTY(BlueprintReadWrite)
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:

> **[Forward declaration](https://en.wikipedia.org/wiki/Forward_declaration)**
>
> In computer programming, a forward declaration is a declaration of an identifier (denoting an entity such as a type, a variable, a constant, or a function) for which the programmer has not yet given a complete definition.
> It is required for a compiler to know certain properties of an identifier (size for memory allocation, data type for type checking, such as type signature of functions), but not other details, like the particular value it holds (in case of variables or constants) or definition ...

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...
