Can no longer add any new Functions to one class.

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.

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

1 Like

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.

1 Like

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