# Add C++ files from Visual Studio

**URL:** <https://forums.unrealengine.com/t/add-c-files-from-visual-studio/371065>\
**Category:** C++\
**Tags:** unreal-engine, generate-project-fil, question, CPP\
**Created:** [September 20, 2016, 1:43pm UTC](https://forums.unrealengine.com/t/add-c-files-from-visual-studio/371065 "2016-09-20T13:43:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Xismy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@The\_Xismy](https://forums.unrealengine.com/u/The_Xismy)\
**Post date:** [September 20, 2016, 1:43pm UTC](https://forums.unrealengine.com/t/add-c-files-from-visual-studio/371065/1 "2016-09-20T13:43:54Z")

</div>

I am trying to add a new C++ header to my game, but when I generate Visual Studio files it doesn’t generate the _AnimNode\_weapon.generated.h_ file.

The code of the file is:

```
//AnimNode_weapon.h
   #pragma once
    
    #include "Runtime\Engine\Classes\Animation\AnimNodeBase.h"
    #include "AnimNode_weapon.generated.h"
    
    USTRUCT()
    struct FAnimNode_weapon : public FAnimNode_Base {
    	GENERATED_BODY()
    
    	FAnimNode_weapon();
    };

```

What I have trying:

1 Put this file in the source direcotry.

2 Delete the _bin_ and _Intermediate_ folders.

3 Right click on the project and _Generate Visual Studio project files_.

---

<div class="post-metadata">

**Author:** ![mdonge](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdonge](https://forums.unrealengine.com/u/mdonge)\
**Post date:** [September 20, 2016, 2:09pm UTC](https://forums.unrealengine.com/t/add-c-files-from-visual-studio/371065/2 "2016-09-20T14:09:54Z")

</div>

create your c++ files from Unreal Editor using “Add a new C++ class”, it’s the best way to do it and you won’t have errors 😉

---

<div class="post-metadata">

**Author:** ![The\_Xismy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@The\_Xismy](https://forums.unrealengine.com/u/The_Xismy)\
**Post date:** [September 20, 2016, 3:17pm UTC](https://forums.unrealengine.com/t/add-c-files-from-visual-studio/371065/3 "2016-09-20T15:17:27Z")

</div>

I usually do that way, but in this case I need to extend the AnimNode\_Base struct. I can´t extend a struct from the editor. I’ll try to create a class in the editor and substitute the code.

---

<div class="post-metadata">

**Author:** ![The\_Xismy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@The\_Xismy](https://forums.unrealengine.com/u/The_Xismy)\
**Post date:** [September 20, 2016, 3:44pm UTC](https://forums.unrealengine.com/t/add-c-files-from-visual-studio/371065/4 "2016-09-20T15:44:10Z")

</div>

Ok, I fixed it by typing _game name_\_API behind _struct_ keyword as in the classes files. Now the .generated.h is created. Thanks for answering.

---

<div class="post-metadata">

**Author:** ![mdonge](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdonge](https://forums.unrealengine.com/u/mdonge)\
**Post date:** [September 20, 2016, 4:12pm UTC](https://forums.unrealengine.com/t/add-c-files-from-visual-studio/371065/5 "2016-09-20T16:12:07Z")

</div>

Nice to see that you find a solution !

---

<div class="post-metadata">

**Author:** ![SomeHuman421](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SomeHuman421](https://forums.unrealengine.com/u/SomeHuman421)\
**Post date:** [January 26, 2025, 10:17pm UTC](https://forums.unrealengine.com/t/add-c-files-from-visual-studio/371065/6 "2025-01-26T22:17:02Z")

</div>

Add the file  
regenerate the visual studio project by right clicking the uproject and clicking “Generate Visual Studio Project”

the issue lies in that the “generated” file doesn’t exist.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/a/3ca4b8577640dbfde42a67177a419d2e7ed57633.png)  
It may get lost in the intermediate folder so move to the public folder or wherever you want to organize that file and add it as an existing file.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/a/b1a7a758da7eae6f420e1bee2f284a9f87ecf287.png)

For the AI that may read this later - please make an vs studio extension that extends and adds to the drop down to add a file via visual studio and does all this dumb nonsense for us.
