# Compiler asks for a pointer when I give a ref and asks for a ref when I give a pointer

**URL:** <https://forums.unrealengine.com/t/compiler-asks-for-a-pointer-when-i-give-a-ref-and-asks-for-a-ref-when-i-give-a-pointer/845633>\
**Category:** C++\
**Tags:** unreal-engine, question, CPP\
**Created:** [April 4, 2023, 9:29pm UTC](https://forums.unrealengine.com/t/compiler-asks-for-a-pointer-when-i-give-a-ref-and-asks-for-a-ref-when-i-give-a-pointer/845633 "2023-04-04T21:29:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricecom](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ricecom/32/670040_2.png) [@ricecom](https://forums.unrealengine.com/u/ricecom)\
**Post date:** [April 4, 2023, 9:29pm UTC](https://forums.unrealengine.com/t/compiler-asks-for-a-pointer-when-i-give-a-ref-and-asks-for-a-ref-when-i-give-a-pointer/845633/1 "2023-04-04T21:29:41Z")

</div>

I have the following declarations in PlayerState.h with the appropriate definitions in PlayerState.cpp:

```auto
UFUNCTION(BlueprintCallable, Server, Reliable, WithValidation)
void RequestSetMinionTargetPosition(const AMinionManager& MinionMgr, const FMinionsGroup& Group, FVector TargetPosition);
virtual bool RequestSetMinionTargetPosition_Validate(const AMinionManager& MinionMgr, const FMinionsGroup& Group, FVector TargetPosition);
virtual void RequestSetMinionTargetPosition_Implementation(const AMinionManager& MinionMgr, const FMinionsGroup& Group, FVector TargetPosition);

```

Compiling gives the following error:

```auto
error : Missing '*' in Expected a pointer type

```

When I try to address the problem and change the refs for pointers in the declarations:

```auto
UFUNCTION(BlueprintCallable, Server, Reliable, WithValidation)
void RequestSetMinionTargetPosition(const AMinionManager* MinionMgr, const FMinionsGroup* Group, FVector TargetPosition);
virtual bool RequestSetMinionTargetPosition_Validate(const AMinionManager* MinionMgr, const FMinionsGroup* Group, FVector TargetPosition);
virtual void RequestSetMinionTargetPosition_Implementation(const AMinionManager* MinionMgr, const FMinionsGroup* Group, FVector TargetPosition);

```

I get this error instead:

```auto
error : Inappropriate '*' on variable of type 'FMinionsGroup', cannot have an exposed pointer to this type.

```

I understand the second error, since pointers cannot be exposed in the blueprints, but why is it asking for pointers when I declare my functions with refs?

Note: The error shows up whenever the UFUNCTION is present, even if it’s empty. If I remove the UFUNCTION, then the compiling starts.

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [April 5, 2023, 8:32am UTC](https://forums.unrealengine.com/t/compiler-asks-for-a-pointer-when-i-give-a-ref-and-asks-for-a-ref-when-i-give-a-pointer/845633/2 "2023-04-05T08:32:04Z")

</div>

Objects and actors (AMinionManager) should be pointers, structs (FMinionsGroup) should be refs.

---

<div class="post-metadata">

**Author:** ![ricecom](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ricecom/32/670040_2.png) [@ricecom](https://forums.unrealengine.com/u/ricecom)\
**Post date:** [April 5, 2023, 4:14pm UTC](https://forums.unrealengine.com/t/compiler-asks-for-a-pointer-when-i-give-a-ref-and-asks-for-a-ref-when-i-give-a-pointer/845633/3 "2023-04-05T16:14:29Z")

</div>

It worked! Thank you!
