# How create a .generated.h file

**URL:** <https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131>\
**Category:** C++\
**Tags:** error-code, unreal-engine, UE4, CPP, question\
**Created:** [June 9, 2016, 12:43am UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131 "2016-06-09T00:43:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Damien2k15](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Damien2k15](https://forums.unrealengine.com/u/Damien2k15)\
**Post date:** [June 9, 2016, 12:43am UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/1 "2016-06-09T00:43:31Z")

</div>

Hi guys.

I create a plugin using ue4 wizard and after start programming I had the need to create new files .h cpp

I make the build and try using “Generate Visual Studio project files” to generate a .generated.h file but in VS2015 continue give me a error: cannot open source file “filename.generated.h”

How can I resolve this erro?

My Code:

```
#pragma once

#include "Filename.generated.h"

UCLASS()
class AFilename : public APlayerController
{

};

```

Thanks

---

<div class="post-metadata">

**Author:** ![Damien2k15](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Damien2k15](https://forums.unrealengine.com/u/Damien2k15)\
**Post date:** [June 9, 2016, 1:32am UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/2 "2016-06-09T01:32:29Z")

</div>

When I try search for the file in Solution Explorer Search, don’t find too.  
I’m update my code.

```
#pragma once

#include "Runtime/Engine/Classes/GameFramework/PlayerController.h"
#include "Filename.generated.h"

UCLASS()
class FILENAME_API AFilename : public APlayerController
{
	GENERATED_UCLASS_BODY()
};
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ef23e124](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ef23e124](https://forums.unrealengine.com/u/anonymous_user_ef23e124)\
**Post date:** [June 9, 2016, 1:48am UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/3 "2016-06-09T01:48:10Z")

</div>

Hey there ,

Take a look in the “intermediate” directory for the project (not for the plugin), then look in “projectfiles”, there I think you will find your cpp and h file, move them into the private and public folders for the plugin, then regenerate the VS2015 project files, and I think you will be good to go.

Inc.

---

<div class="post-metadata">

**Author:** ![Damien2k15](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Damien2k15](https://forums.unrealengine.com/u/Damien2k15)\
**Post date:** [June 9, 2016, 2:16am UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/4 "2016-06-09T02:16:14Z")

</div>

Hi there Jayice

Don`t work for me. I deleted all the files that had create of the project and did a build and generate again. Then I created using the Add New option VS2015 and created the two files .h and .cpp, which were to projectfiles folder. I hung up the VS2015 and EU4 Editor and moved these two files into the folders: Plugins / NomePlugin / Source / Private and Public. Regenerate the project via second button “Generate VS Project Files” and give me same error…

---

<div class="post-metadata">

**Author:** ![Damien2k15](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Damien2k15](https://forums.unrealengine.com/u/Damien2k15)\
**Post date:** [June 9, 2016, 2:39am UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/5 "2016-06-09T02:39:15Z")

</div>

Hi Jayice,

I was seeing now website and saw that has a script, prety cool!!!.what I’m trying to do something like that, only a Roller Coaster. You can pass me some tips and or tutorials, I can already do BP\_Spline system and follow geometry and build the tracks, I’m just having trouble creating the Wagon system following line and can change its speed when I was in free fall. I wanted to use a variable gravity type and multiply it by the DeltaTime (EventTick) to speed when I was in decline and decrease when rising.

Its possible? You can help-me?

---

<div class="post-metadata">

**Author:** ![Damien2k15](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Damien2k15](https://forums.unrealengine.com/u/Damien2k15)\
**Post date:** [June 9, 2016, 2:41am UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/6 "2016-06-09T02:41:04Z")

</div>

I like too detect when the spline have tangent to wagon follow

---

<div class="post-metadata">

**Author:** ![Damien2k15](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Damien2k15](https://forums.unrealengine.com/u/Damien2k15)\
**Post date:** [June 9, 2016, 3:09am UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/7 "2016-06-09T03:09:27Z")

</div>

In the system I had created, to build the raill, I follow [this tutorial](https://www.youtube.com/watch?v=wR0fH6O9jD8) But when I put a Pawn or other SM to follow this stops before finished the circuity because this script have a variable to close the loop and it is not a really Spline to close.

---

<div class="post-metadata">

**Author:** ![\_SeveneduS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_SeveneduS](https://forums.unrealengine.com/u/_SeveneduS)\
**Post date:** [September 30, 2016, 2:38pm UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/8 "2016-09-30T14:38:52Z")

</div>

Just add somewhere in the interface file (yourheader.h) USTRUCT and rebuild solution. Than close visual studio and re “Generate Visual Studio Project file”. Voila.

```
USTRUCT()
struct FAyStruct
{
	GENERATED_USTRUCT_BODY()

};
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8e28bd7f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8e28bd7f](https://forums.unrealengine.com/u/anonymous_user_8e28bd7f)\
**Post date:** [December 14, 2017, 5:20pm UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/9 "2017-12-14T17:20:00Z")

</div>

From 4.12+ I believe it’s GENERATED\_BODY() for classes and structs, etc

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8e28bd7f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8e28bd7f](https://forums.unrealengine.com/u/anonymous_user_8e28bd7f)\
**Post date:** [December 14, 2017, 5:20pm UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/10 "2017-12-14T17:20:28Z")

</div>

FYI. From 4.12+ it’s GENERATED\_BODY() structs.

---

<div class="post-metadata">

**Author:** ![NeveraiN](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NeveraiN](https://forums.unrealengine.com/u/NeveraiN)\
**Post date:** [December 7, 2021, 5:31pm UTC](https://forums.unrealengine.com/t/how-create-a-generated-h-file/360131/11 "2021-12-07T17:31:41Z")

</div>

try this:

> [@no generated.h file](https://forums.unrealengine.com/t/no-generated-h-file/107387/8):
>
> for anyone with the same issue. English Version add a new \*.h file add the following code#include "CoreMinimal.h" USTRUCT(BlueprintType) struct FMyNewStruct { GENERATED\_BODY() }; Note: Struct name start with F Note: GENERATED\_BODY is required Build Solution Note: there will be compile error, just ignore Note: you can not find the new struct in UE Editor Note: this compile action will start UnrealHeaderTool that will generate \*.generated.h Edit code，include \*.generated.h#include "Core…
