# Can no longer add any new Functions to one class.

**URL:** <https://forums.unrealengine.com/t/can-no-longer-add-any-new-functions-to-one-class/1805449>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, CPP, question\
**Created:** [April 15, 2024, 9:14pm UTC](https://forums.unrealengine.com/t/can-no-longer-add-any-new-functions-to-one-class/1805449 "2024-04-15T21:14:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GaruShangAbi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GaruShangAbi](https://forums.unrealengine.com/u/GaruShangAbi)\
**Post date:** [April 15, 2024, 9:14pm UTC](https://forums.unrealengine.com/t/can-no-longer-add-any-new-functions-to-one-class/1805449/1 "2024-04-15T21:14:50Z")

</div>

I’m pretty sure this a strictly Visual Studio problem, but suddenly when I add a function, Visual Studio seems unable to create a function definition. It just says “Failed to return new Code Element. Possibly syntax error. New Element Name: NewFunction”. Then it copies it to my clipboard. When I paste it into my class.cpp file, it takes some wrestling for the code editor to recognize the new definition as the definition for the declared function in the .h file. Not only that but after that is done, it will simply never build until I remove the added function. The error is “class.h(line of declaration): error : void type is only valid as a return type” and “Found ‘(’ when expecting ‘;’ while parsing class ‘class’”, as if my function declaration was seen as a variable. I don’t think I’m doing anything differently. I have no clue as to what could have caused this.  
Note that this is ONE class. For some reason, creating a new function in any other class does not reproduce this error.

---

<div class="post-metadata">

**Author:** ![Wildlight03](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wildlight03](https://forums.unrealengine.com/u/Wildlight03)\
**Post date:** [April 15, 2024, 9:22pm UTC](https://forums.unrealengine.com/t/can-no-longer-add-any-new-functions-to-one-class/1805449/2 "2024-04-15T21:22:32Z")

</div>

Can you post a screenshot of the function in the .h and .cpp?

---

<div class="post-metadata">

**Author:** ![GaruShangAbi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GaruShangAbi](https://forums.unrealengine.com/u/GaruShangAbi)\
**Post date:** [April 15, 2024, 9:44pm UTC](https://forums.unrealengine.com/t/can-no-longer-add-any-new-functions-to-one-class/1805449/3 "2024-04-15T21:44:26Z")

</div>

My bad. I figured out why the build wasn’t happening. The function definiton had some code that required an include (Components/SceneComponent.h). The reason I did not consider it was because I had the same code in my Tick function so I assumed that it wasn’t something I needed to include.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [May 15, 2024, 9:45pm UTC](https://forums.unrealengine.com/t/can-no-longer-add-any-new-functions-to-one-class/1805449/4 "2024-05-15T21:45:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
