Add a custom header file throws many errors

Hi!

I’m using Unreal Engine 5.3.2 with Visual Studio 2022.

I have added a custom header file only adding a empty text file with .h extension and I get these errors:

[1/5] Compile [x64] CatalogueStructs.gen.cpp
C:\MyProject\Source\MyModule\public\CatalogueStructs.h(8): error C4430: type specifier is missing; int is assumed. Note: C++ does not support default-int
C:\MyProject\Intermediate\Build\Win64\UnrealEditor\Inc\MyModule\UHT\CatalogueStructs.gen.cpp(16): error C2039: ‘StaticStruct’: not a member of ‘FStar1’.
C:\MyProjectSource\MyModule\UHT\CatalogueStructs.h(6): note: see declaration of ‘FStar1’.
C:\MyProjectIntermediate\Build\Win64\UnrealEditor\IncMyModule\UHT\CatalogueStructs.gen.cpp(26): error C2039: ‘StaticStruct’: not a member of ‘FStar1’.
C:\MyProjectSource\MyModule\UHT\CatalogueStructs.h(6): note: see declaration of ‘FStar1’.
C:\MyProjectIntermediate\Build\Win64\UnrealEditor\IncMyModule\UHT\CatalogueStructs.gen.cpp(72): error C2039: ‘StaticStruct’: not a member of ‘FStar1’.
C:\MyProjectSource\MyModule\UHT\CatalogueStructs.h(6): note: see declaration of ‘FStar1’.

This is the header file:


#pragma once

#include "CoreMinimal.h"

USTRUCT(BlueprintType)
struct FStar1
{
	GENERATED_BODY()

	int32 Hip;
	bool ToShow;
	double RArad;
	double DErad;
	double Hpmag;
	FString GreekLetter;
	FString CommonName;
	FString Constellation;
	double Plx;
};

How can I fix this error?

I have fixed adding #include "CatalogueStructs.generated.h":

#pragma once

#include "CoreMinimal.h"
#include "CatalogueStructs.generated.h"

USTRUCT(BlueprintType)
struct FStar1
{
	GENERATED_BODY()

	int32 Hip;
	bool ToShow;
	double RArad;
	double DErad;
	double Hpmag;
	FString GreekLetter;
	FString CommonName;
	FString Constellation;
	double Plx;
};

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