# Declare delegate in one header file and use it in other headers

**URL:** <https://forums.unrealengine.com/t/declare-delegate-in-one-header-file-and-use-it-in-other-headers/483914>\
**Category:** C++\
**Tags:** header, unreal-engine, delegates, question, CPP\
**Created:** [May 26, 2021, 7:48am UTC](https://forums.unrealengine.com/t/declare-delegate-in-one-header-file-and-use-it-in-other-headers/483914 "2021-05-26T07:48:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_da48ad62](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_da48ad62](https://forums.unrealengine.com/u/anonymous_user_da48ad62)\
**Post date:** [May 26, 2021, 7:48am UTC](https://forums.unrealengine.com/t/declare-delegate-in-one-header-file-and-use-it-in-other-headers/483914/1 "2021-05-26T07:48:46Z")

</div>

Hello,

I have a very simple query to which I was not able to find an answer from a quick google search. Maybe because its too obvious or its a silly question.

Lets say I have a two classes A and B having their own header and cpp files. I declare a delegate signature in class A’s header file like so DECLARE\_DYNAMIC\_DELEGATE\_OneParam(FGameStateChange, bool, newState); and use it declare a delegate in the same header.

Now I want to reuse this signature to declare a delegate in B’s header file without having to include the A’s header in B’s header.

Any ideas how to do this? Do I have to just declare the same delegate signature in B again?

I hope I did not phrase the question in a confusing way.

Thanks

---

<div class="post-metadata">

**Author:** ![Slavical](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Slavical](https://forums.unrealengine.com/u/Slavical)\
**Post date:** [October 21, 2021, 11:25am UTC](https://forums.unrealengine.com/t/declare-delegate-in-one-header-file-and-use-it-in-other-headers/483914/2 "2021-10-21T11:25:26Z")

</div>

Look at ActionRPGTypes.h in the ActionRPG source. You make a header that only includes structs, enums, and delegates and include that header in all your classes.

---

<div class="post-metadata">

**Author:** ![treterterakterx](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/treterterakterx/32/914279_2.png) [@treterterakterx](https://forums.unrealengine.com/u/treterterakterx)\
**Post date:** [September 8, 2024, 12:26am UTC](https://forums.unrealengine.com/t/declare-delegate-in-one-header-file-and-use-it-in-other-headers/483914/3 "2024-09-08T00:26:19Z")

</div>

Use UDELEGATE() macro when defining delegates in a shared header file.

Could not find anything about it on the internet, posting this from browsing unreal source code and finding a usage like this.

MySharedHeaderFile.h

```auto
#pragma once

#include "CoreMinimal.h"
#include "MySharedHeaderFile.generated.h"

UDELEGATE()
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FMyDelegateSignature);

```

---

<div class="post-metadata">

**Author:** ![RobMeade](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RobMeade](https://forums.unrealengine.com/u/RobMeade)\
**Post date:** [October 22, 2024, 9:38pm UTC](https://forums.unrealengine.com/t/declare-delegate-in-one-header-file-and-use-it-in-other-headers/483914/4 "2024-10-22T21:38:24Z")

</div>

Thank you for sharing this, I had a challenging evening last night going around in circles wondering what I was missing. Stumbling across your reply to this post resolved the issue for me - thank you 🙂
