Hi,
I’m trying to create a global struct, but I cant get it to work.
I Added a new C++ file with the Editor Function “Add New C++ File” and chosed “None” as base class.
The .cpp is empty.
.h:
#pragma once
#include "Engine.h"
#include "Spaceship_Structs.generated.h";
USTRUCT()
struct FTest
{
GENERATED_USTRUCT_BODY()
int Var1;
int Var2;
};
With this Code, i get the following error messages:
1>D:\Unreal Projects\Spaceship\Source\Spaceship\Public\Spaceship_Structs.h(6): error C4067: unexpected tokens following preprocessor directive - expected a newline
1>D:\Unreal Projects\Spaceship\Source\Spaceship\Public\Spaceship_Structs.h(6): error C4067: unexpected tokens following preprocessor directive - expected a newline
If I remove the .generated.h, i get the following error messages (Line 13 is the GENERATED_USTRUCT_BODY() makro):
1>D:\Unreal Projects\Spaceship\Source\Spaceship\Public\Spaceship_Structs.h(13): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
I already removed the .vs, Binaries, Intermediate and Saved folder and .sln file and generated the visual studio project files via right click on the .uproject file, but it still does not work.
I couldn’t find any other things to do. Does anyone has an idea whats wrong here?
Thanks in advance!