Cant compile to save my life / GENERATED_BODY() stops compiling

The cpp file is fine, anyone see anything wrong with the below header file? Using VS2015.

#include “Display.generated.h”

#pragma once

class CARZ_API Display
{
public:
Display();
~Display();

UFUNCTION(BlueprintPure, Category = Utility)
	static TArray<struct FDisplayInfo> GetDisplayResolutions();

};

USTRUCT(BlueprintType)
struct FDisplayInfo
{
GENERATED_BODY()

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)

int32 Width;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
int32 Height;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
int32 RefreshRate;

FDisplayInfo()
{
	Width = Height = RefreshRate = 0;
}

};


generated_ustruct_body()

Doesn’t change anything and I’ve read that command has been deprecated.

What errors do you have?

Your class “Display” needs to be a UCLASS with a generated body, if you want to have UFUCNTIONS in it.

I assume you need to add the UCLASS() macro above the definition of the Display class, or you need to remove the UFUNCTION(…) macro from its GetDisplayResolution() function.


UCLASS()
class CARZ_API Display
{
    GENERATED_BODY()
    ...
};

I would start at:



#pragma once
#include "UObject/NoExportTypes.h"
#include "Display.generated.h"

USTRUCT(BlueprintType)
struct FDisplayInfo
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
	int32 Width;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
	int32 Height;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
	int32 RefreshRate;

	FDisplayInfo()
	{
		Width = Height = RefreshRate = 0;
	}
};

UCLASS( )
class F133110_API UDisplay : public UObject
{
	GENERATED_BODY( )
public:
	UDisplay( );

	UPROPERTY( )
	TArray<struct FDisplayInfo> Info;

	UFUNCTION(BlueprintPure, Category = Utility)
	TArray<struct FDisplayInfo> GetDisplayResolutions() { return Info; }
};


I’ve made some changes, and now I get “Unrecognized type ‘UDisplayInfo’ - type must be a UCLASS, USTRUCT or UENUM” on the static GetDisplayResolutions line. But, UDisplayInfo is an USTRUCT.

#include “Display.generated.h”

#pragma once

UCLASS(Blueprintable)
class CARZ_API UDisplay : public UObject
{
public:
GENERATED_BODY()

UDisplay();
~UDisplay();

UFUNCTION(BlueprintPure, Category = Utility)
static TArray&lt;struct UDisplayInfo&gt; GetDisplayResolutions();

};

USTRUCT(BlueprintType)
struct UDisplayInfo
{
GENERATED_BODY()

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
int32 Width;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
int32 Height;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
int32 RefreshRate;

UDisplayInfo()
{
	Width = Height = RefreshRate = 0;
}

};

You’ll have to declare the struct before using it in the class. You are also missing an include for the UObject:
#include “UObject/NoExportTypes.h”

Look at the post above and compare.

Yes, added the NoExportTypes.h. Not sure what the point of that is, but it’s in there. Now I get a ton of new errors. Here’e the cpp as well. I can’t believe this is so much trouble. The errors are even misleading because of the Unreal Macros jacking up the syntax.


#pragma once
#include “UObject/NoExportTypes.h”
#include “Display.generated.h”

USTRUCT(BlueprintType)
struct FDisplayInfo
{
GENERATED_BODY()

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
int32 Width;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
int32 Height;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
int32 RefreshRate;

FDisplayInfo()
{
	Width = Height = RefreshRate = 0;
}

};

UCLASS(Blueprintable)
class CARZ_API UDisplay : public UObject
{
GENERATED_BODY()

public:

UDisplay();

UFUNCTION(BlueprintPure, Category = Utility)
static TArray&lt;struct FDisplayInfo&gt; GetDisplayResolutions();

};

#include “Carz.h”
#include “Display.h”

UDisplay::UDisplay()
{
}

TArray<FDisplayInfo> UDisplay::GetDisplayResolutions()
{
TArray<FDisplayInfo> ResolutionsToReturn;
FScreenResolutionArray Resolutions;
if (RHIGetAvailableResolutions(Resolutions, false))
{
// Preallocate just enough memory to store all elements
ResolutionsToReturn.Reserve(Resolutions.Num());

	for (const FScreenResolutionRHI& EachResolution : Resolutions)
	{
		FDisplayInfo Info;
		Info.Width = EachResolution.Width;
		Info.Height = EachResolution.Height;
		Info.RefreshRate = EachResolution.RefreshRate;
		ResolutionsToReturn.Add(Info);
	}
}
return ResolutionsToReturn;

}

You are missing dependencies for the use of: RHIGetAvailableResolutions( ) and FScreenResolutionArray.

[GameName.Build.cs]



PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "RHI" });


[h]



#pragma once
#include "UObject/NoExportTypes.h"
#include "Display.generated.h"

USTRUCT(BlueprintType)
struct FDisplayInfo
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
	int32 Width;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
	int32 Height;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DisplayInfo)
	int32 RefreshRate;

	FDisplayInfo()
	{
		Width = Height = RefreshRate = 0;
	}
};

UCLASS( )
class F133110_API UDisplay : public UObject
{
	GENERATED_BODY( )
public:
	UDisplay( );

	UFUNCTION(BlueprintPure, Category = Utility)
	TArray<struct FDisplayInfo> GetDisplayResolutions();
};



**[cpp]
**



#include "F133110.h"
#include "Runtime/RHI/Public/DynamicRHI.h"
#include "Runtime/NullDrv/Public/NullRHI.h"
#include "Display.h"

UDisplay::UDisplay( )
{
}

TArray<FDisplayInfo> UDisplay::GetDisplayResolutions( )
{
	TArray<FDisplayInfo> ResolutionsToReturn;	
	FScreenResolutionArray Resolutions;
	if( RHIGetAvailableResolutions( Resolutions, false ) )
	{
		for( FScreenResolutionRHI RHI : Resolutions )
		{
			FDisplayInfo DisplayInfo;
			DisplayInfo.Width = RHI.Width;
			DisplayInfo.Height = RHI.Height;
			DisplayInfo.RefreshRate = RHI.RefreshRate;
			ResolutionsToReturn.Add( DisplayInfo );
		}
	}
	
	return ResolutionsToReturn;
}


Still doesn’t compile. I have 70 errors and what you see is the whole project. It’s really frustrating actually.

Here’s the build log if anything jumps out to anyone. Thanks.

1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Build started: Project: Carz, Configuration: Development_Editor x64 ------
2> Performing 3 actions (4 in parallel)
2> Display.cpp
2> Carz.generated.cpp
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(15): error C2007: #define syntax
2>i:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(15): error C2007: #define syntaxI:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(20): error C2007: #define syntax
2>
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(31): error C2007: #define syntaxi:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(20): error C2007: #define syntax
2>
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(42): error C2007: #define syntaxi:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(31): error C2007: #define syntax
2>
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(53): error C2007: #define syntax
2>i:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(42): error C2007: #define syntax
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(64): error C2007: #define syntax
2>i:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(53): error C2007: #define syntaxI:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(77): error C2007: #define syntax
2>
2>i:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(64): error C2007: #define syntaxI:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(88): error C2007: #define syntax
2>
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(89): error C2007: #define syntax
2>i:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(77): error C2007: #define syntax
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(90): error C2007: #define syntax
2>i:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(88): error C2007: #define syntaxI:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Display.generated.h(101): error C2007: #define syntax
2>
2>i:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(89): error C2007: #define syntax
2>i:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(90): error C2007: #define syntax
2>i:\unreal\Carz\4.14\intermediate\build\win64\ue4editor\inc\Carz\Display.generated.h(101): error C2007: #define syntax
2>i:\unreal\Carz\4.14\source\Carz\Display.h(8): error C2059: syntax error: ‘user-defined literal’
2>I:\Unreal\Carz\4.14\Source\Carz\Display.h(8): error C2059: syntax error: ‘user-defined literal’
2>i:\unreal\Carz\4.14\source\Carz\Display.h(11): error C2238: unexpected token(s) preceding ‘;’
2>I:\Unreal\Carz\4.14\Source\Carz\Display.h(11): error C2238: unexpected token(s) preceding ‘;’
2>I:\Unreal\Carz\4.14\Source\Carz\Display.h(21): error C2065: ‘Width’: undeclared identifieri:\unreal\Carz\4.14\source\Carz\Display.h(21): error C2065: ‘Width’: undeclared identifier
2>
2>I:\Unreal\Carz\4.14\Source\Carz\Display.h(25): error C2059: syntax error: 'user-defined literal’i:\unreal\Carz\4.14\source\Carz\Display.h(25): error C2059: syntax error: ‘user-defined literal’
2>
2>i:\unreal\Carz\4.14\source\Carz\Display.h(26): error C2059: syntax error: 'public’I:\Unreal\Carz\4.14\Source\Carz\Display.h(26): error C2059: syntax error: ‘public’
2>i:\unreal\Carz\4.14\source\Carz\Display.h(27): error C2143: syntax error: missing ‘;’ before ‘{’
2>
2>I:\Unreal\Carz\4.14\Source\Carz\Display.h(27): error C2143: syntax error: missing ‘;’ before ‘{’
2>I:\Unreal\Carz\4.14\Source\Carz\Display.h(27): error C2447: ‘{’: missing function header (old-style formal list?)i:\unreal\Carz\4.14\source\Carz\Display.h(27): error C2447: ‘{’: missing function header (old-style formal list?)
2>
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(13): error C2039: ‘StaticStruct’: is not a member of ‘FDisplayInfo’
2> I:\Unreal\Carz\4.14\Source\Carz\Display.h(7): note: see declaration of ‘FDisplayInfo’
2>I:\Unreal\Carz\4.14\Source\Carz\Display.cpp(5): error C2653: ‘UDisplay’: is not a class or namespace name
2>I:\Unreal\Carz\4.14\Source\Carz\Display.cpp(6): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>I:\Unreal\Carz\4.14\Source\Carz\Display.cpp(7): error C4508: ‘UDisplay’: function should return a value; ‘void’ return type assumed
2>I:\Unreal\Carz\4.14\Source\Carz\Display.cpp(9): error C2653: ‘UDisplay’: is not a class or namespace name
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(25): error C2039: ‘StaticStruct’: is not a member of ‘FDisplayInfo’
2> I:\Unreal\Carz\4.14\Source\Carz\Display.h(7): note: see declaration of ‘FDisplayInfo’
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(33): error C2653: ‘UDisplay’: is not a class or namespace name
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(35): error C2653: ‘UDisplay’: is not a class or namespace name
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(35): error C3861: ‘StaticClass’: identifier not found
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(35): error C2065: ‘execGetDisplayResolutions’: undeclared identifier
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C2065: ‘UDisplay’: undeclared identifier
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C2923: ‘TClassCompiledInDefer’: ‘UDisplay’ is not a valid template type argument for parameter ‘TClass’
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C2514: ‘TClassCompiledInDefer’: class has no constructors
2> D:\Program Files (x86)\Epic Games\4.14\Engine\Source\Runtime\CoreUObject\Public\UObject\UObjectBase.h(297): note: see declaration of ‘TClassCompiledInDefer’
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C2653: ‘UDisplay’: is not a class or namespace name
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C2065: ‘StaticClassFlags’: undeclared identifier
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C3861: ‘StaticClassCastFlags’: identifier not found
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C3861: ‘StaticConfigName’: identifier not found
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C2440: ‘type cast’: cannot convert from ‘void (__cdecl *)(const FObjectInitializer &)’ to ‘UClass::ClassConstructorType’
2> I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): note: None of the functions with this name in scope match the target type
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C2440: ‘type cast’: cannot convert from ‘UObject *(__cdecl *)(FVTableHelper &)’ to ‘UClass::ClassVTableHelperCtorCallerType’
2> I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): note: None of the functions with this name in scope match the target type
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C2065: ‘AddReferencedObjects’: undeclared identifier
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(37): error C2065: ‘StaticClass’: undeclared identifier
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(57): error C2039: ‘Width’: is not a member of ‘FDisplayInfo’
2> I:\Unreal\Carz\4.14\Source\Carz\Display.h(7): note: see declaration of ‘FDisplayInfo’
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(57): error C2664: ‘UIntProperty::UIntProperty(const UIntProperty &)’: cannot convert argument 1 from ‘FObjectInitializer’ to ‘ECppProperty’
2> I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(57): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(99): error C2653: ‘UDisplay’: is not a class or namespace name
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(99): error C3861: ‘StaticClass’: identifier not found
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(108): error C2653: ‘UDisplay’: is not a class or namespace name
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(108): error C3861: ‘StaticClass’: identifier not found
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(130): error C2653: ‘UDisplay’: is not a class or namespace name
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(130): error C2065: ‘StaticClass’: undeclared identifier
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(131): error C2653: ‘UDisplay’: is not a class or namespace name
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(131): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(131): error C2550: ‘UDisplay’: constructor initializer lists are only allowed on constructor definitions
2>I:\Unreal\Carz\4.14\Intermediate\Build\Win64\UE4Editor\Inc\Carz\Carz.generated.cpp(131): error C4508: ‘UDisplay’: function should return a value; ‘void’ return type assumed
2>I:\Unreal\Carz\4.14\Source\Carz\Display.cpp(19): error C2039: ‘Width’: is not a member of ‘FDisplayInfo’
2> i:\unreal\Carz\4.14\source\Carz\Display.h(7): note: see declaration of ‘FDisplayInfo’
2>ERROR : UBT error : Failed to produce item: I:\Unreal\Carz\4.14\Binaries\Win64\UE4Editor-Carz.dll
2> Total build time: 6.18 seconds
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(41,5): error MSB3075: The command ““D:\Program Files (x86)\Epic Games\4.14\Engine\Build\BatchFiles\Build.bat” CarzEditor Win64 Development “I:\Unreal\Carz\4.14\Carz.uproject” -waitmutex” exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

What I posted earlier does compile. I tested on my end.

error C2065: ‘Width’: undeclared identifier - Width not defined or included
error C2059: syntax error: ‘public’ - missing “:” after public?
‘UDisplay’: function should return a value; ‘void’ return type assumed - function not returning type it supposed to
‘StaticStruct’: is not a member of ‘FDisplayInfo’ - Using “StaticStruct” as a member of FDisplayInfo, which doesnt exist as a member
‘execGetDisplayResolutions’: undeclared identifier - Not defined or included
‘UDisplay’: undeclared identifier - Not defined or included in file
‘TClassCompiledInDefer’: ‘UDisplay’ is not a valid template type argument for parameter ‘TClass’ - invalid template

Now, with that said, because you are getting a “Exited with code 5. Please verify that you have sufficient rights to run this command” as a error, It is possible that the compiling errors are related to a macro trying to use something that doesn’t exist, causing a whole mess of issues with the generated.h compile.

Break down what you are trying to do into something smaller and go step-by-step, making sure the code compiles each time. If it doesn’t, try to figure out what the changes could of done. Make sure that if you use a UE4 class that the module that holds it is declared and that the header is included when being used.

Here is some documentation that might help:

https://docs.unrealengine.com/latest/INT/Programming/
https://docs.unrealengine.com/latest/INT/Programming/Tutorials/
https://docs.unrealengine.com/latest/INT/Programming/Introduction/

I think there must be something wrong with the build tool. All I have now is:

[h]



#pragma once
#include "NoExportTypes.h"
#include "Display.generated.h"

UCLASS(Blueprintable)
class CARZ_API UDisplay : public UObject
{
	GENERATED_BODY()

public:
		
	UDisplay();

};


[cpp]



#include "Carz.h"
#include "Display.h"
#include "RHI.h"

UDisplay::UDisplay()
{
}


and I still get 54 compile errors, a lot from the generated files. For example, these 3 show as errors:

#define 4_14_Source_Carz_Display_h_28_RPC_WRAPPERS
#define 4_14_Source_Carz_Display_h_28_RPC_WRAPPERS_NO_PURE_DECLS
#define 4_14_Source_Carz_Display_h_28_INCLASS_NO_PURE_DECLS \

Have you tried creating a blank C++ project via the in-engine Wizard instead of trying to create one by adding source files? This looks like either an installation error or some kind of deeper syntax issue. There’s nothing untoward about what you’ve written there.

As a side-note however, I would personally recommend always using the ObjectInitializer in Constructors. Parameter-less C++ constructors always seem to cause loads of problems.

c++ doesn`t allow to start definitions with digits

ther problem is your folder “I:\Unreal\Carz\4.14\Source\Carz” - “4.14”
unreal build tool use root folder as start point to generate c++ headers for further compilation.
so, change name of your project root folder and re-generate visual studio solution.

Ah!! Thank you so much vitaliiboilo! I thought it was probably something overlooked and stupid like that. It was the generated_body macros or unreal header tool causing the problem because they just go by your folder structure and don’t check for digits when they make up define names. I will post that issue in the Unreal support to make them aware of it. I was pulling my hair out thinking it was my code.

Thanks again, I was at a stop because I was using that base folder, and even if I made a new project, it would have the same problem.

THIS!!!

Has just made my day. Was having a nightmare getting a perfectly functional project to compile after downloading to a new machine from our git repo. Turns out the project directory was getting renamed to the project branch’s name. Which began with a number…

**hell0w0rld123 **your wise words from 3 years ago have saved another soul today! Many thanks!

I had the same problem. After some head scratching I soon realized it was because I had added the files in “the wrong way”.

As mentioned adding the file from the wizard fixed the problem, provided that you select an object type that uses the .generated.h files such as Actor or UObject. Adding an Empty C++ class from the option will result in this error which is a bit deceiving if you’re mainly planning on adding a definition file with enums or structs exposed to Blueprint.

That fixed it. I spent hours searching on every forum why the hell my project wouldn’t open. I called everyone for help, tried every possible things, recreated my project countless of times. Nothing ever worked. I was about to give up until I your reply appeared to me like a light of hope in a world of darkness. You literally saved me and for that, I am eternally grateful.