# Draw Crosshair c++ litle help

**URL:** <https://forums.unrealengine.com/t/draw-crosshair-c-litle-help/310236>\
**Category:** Rendering\
**Tags:** crosshair, draw, canvas, unreal-engine, UE4, CPP, question\
**Created:** [March 10, 2015, 12:30am UTC](https://forums.unrealengine.com/t/draw-crosshair-c-litle-help/310236 "2015-03-10T00:30:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Folgad0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Folgad0](https://forums.unrealengine.com/u/Folgad0)\
**Post date:** [March 10, 2015, 12:30am UTC](https://forums.unrealengine.com/t/draw-crosshair-c-litle-help/310236/1 "2015-03-10T00:30:48Z")

</div>

Hi there, so at this point im drawing the crosshair , and in this lines im getting errors in the word Canvas.

```
void AMyHUD::DrawCrosshair()
{
	float TextureWidth = CrosshairTexture->GetSurfaceWidth();
	float TextureHeight = CrosshairTexture->GetSurfaceHeight();
	 
	FVector2D const CanvasCenter(Canvas->ClipX * 0.5f, Canvas->ClipY * 0.5f);
	FVector2D const DrawPosition(CanvasCenter.X = TextureWidth * 0.5f, CanvasCenter.Y - TextureHeight * 0.5f);

	FCanvasTileItem TileItem(DrawPosition, CrosshairTexture->Resource, FLinearColor::White);
	TileItem.BlendMode = ESimpleElementBlendMode::SE_BLEND_Translucent;

	Canvas->DrawItem(TileItem);
}

```

Im pretty sure it must be something pretty easy.  
It says : Pointer to incomplete class type is not allowed  
And in CanvasCenter it says : expression must be modifiable lvalue

Any help ?  
I’m using version 4.7.2  
Thank you

---

<div class="post-metadata">

**Author:** ![BaderThanBad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BaderThanBad](https://forums.unrealengine.com/u/BaderThanBad)\
**Post date:** [March 11, 2015, 3:50pm UTC](https://forums.unrealengine.com/t/draw-crosshair-c-litle-help/310236/2 "2015-03-11T15:50:31Z")

</div>

You are setting CanvasCenter as constant but modifying it in the next line? (CanvasCenter.X =…)

---

<div class="post-metadata">

**Author:** ![staticvoidlol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@staticvoidlol](https://forums.unrealengine.com/u/staticvoidlol)\
**Post date:** [March 12, 2015, 12:06pm UTC](https://forums.unrealengine.com/t/draw-crosshair-c-litle-help/310236/3 "2015-03-12T12:06:19Z")

</div>

The “Pointer to incomplete class type” error happens when a class is forward-declared in the .h file, but not included in the .cpp file, so you should add an include in your .cpp file for whichever class is giving you trouble.

BaderThanBad has already given the answer to the “Expression must be modifiable” error.

---

<div class="post-metadata">

**Author:** ![Holybreath](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Holybreath](https://forums.unrealengine.com/u/Holybreath)\
**Post date:** [July 5, 2016, 8:41pm UTC](https://forums.unrealengine.com/t/draw-crosshair-c-litle-help/310236/4 "2016-07-05T20:41:04Z")

</div>

Add `#include "Runtime/Engine/Classes/Engine/Canvas.h"` In your HUD .h file. cheers.
