[Solved] I Can't Create new C++ Class

Hello, I try to create new C++ Class but Failed. I have created many class successful before, but yesterday I can’t create for new class.

My Visual Studio’s Version: 2017

This Error:

![)

The Solution that I have tried but doesn’t work.

  1. I tried to close UE4 and Manual Compile via Visual Studio but Failed too. (Same Error)

  1. I tried I set Development Editor but Failed too. (Same Error)

252524-capture2.png

  1. I tried delete .vs/, Binaries/, Intermediate/, Saved/, Project.sln and Generate Visual Studio Project and Rebuild again but doesn’t work too. (Same Error)

  2. If I delete the new class. I can rebuild can compile and everything work fine. (No Error)

  3. I can’t create any class even the class that none-inherit but failed too. (Same Error)

  4. I tried create new class from other project and copy into my project and replace “class NAME_API” and do (3.) but doesn’t work too. (Same Error)

  5. If I delete #include “”, I can rebuild project and compile successful (No Error)

  6. I tried a lot of solution in google but doesn’t help!

  7. If I delete .git/ I can rebuild and compile. But WHY!? I have to use git for my team.

Please Help!
Thank you.

Those look like the unreal engine math functions that aren’t compiling.

You can not create a new C++ class because your project does not compile.

It does not compile because the math functions you are using are not part of the global namespace in your Unreal project.

I am not a professional C++ developer and I may be wrong but it seems to me that you are using the Standard Library math functions which is discouraged in Unreal.

Please replace the following functions with their corresponding functions from FGenericPlatformMath. Alternately you can try adding “std::” in front of them and see if it works.

I would also suggest you use the specified Numeric Types form Introduction to C++ Programming in UE4 documentation. (if you are not already)

I had an issue with some symbols not found and no compile could solve the problem. What I ended doing was to remove every folder from the project root except Source, Content and Config and just the file ProjectName.uproject. Then I launched the game double click the .uproject file and it recompiled everything with no error.
I had no .git folder but I would have kept it has it is not influencing the build.

Can you provide the code of:

MyActor.cpp and MyActor.h

I was just about to point out that these are std functions and then I realized that they are used in GenericPlatformMath.h X)

It seems that it does not compile because the cstdlib does not compile…

@MAD VR Studio Please provide the code of MyActor.h and MyActor.cpp

Hi, Thank you for all answers. XD

Now I can compile successfully.

Solution:
if Unreal’s project have “git”, UE4 will try to use “git status” for detect changed file. This is a bug that made me compile unsuccessful. (I’m not sure but I think UE4 try to compile only changed file)

252900-172859-06082018.png

I have to ignore this step and compile everything. IT’S SUCCESSFUL :slight_smile:

How to ignore this step:
Edit “C:\Users\NAME\AppData\Roaming\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml” file to

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
	<SourceFileWorkingSet>
		<Provider>None</Provider>
		<RepositoryPath></RepositoryPath>
		<GitPath></GitPath>
	</SourceFileWorkingSet>
</Configuration>

And compile again; and It’s work!

1 Like

Now I solved. Thank you sir.
I error because .git/ folder.

MyActor.cpp and MyActor.h are the class that I create new and I didn’t do anything with the class

I had the same problem, and my couse was incorrect project folder name: 700km. Found this after 1 day of crying and anger. Just renamed to name without numbers and all works fine and compiling.

The fix is just the include.
Lets say you create a C++ called Framework\FileComponent.
The CPP will include a file called “Framework\FileComponent.h”
Open the CPP and replace the “Framework” with “.”, so it reads “.\FileComponent.h” or better yet “FileComponent.h”