'StaticStruct': is not a member of 'FTest'

I’m trying to create a struct with C++ but I am receiving this compiling error:

‘StaticStruct’: is not a member of ‘FTest’

This is my code:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"

/**
 *
 */
USTRUCT(BlueprintType)
struct MYPROJECT_API FTest
{
	GENERATED_BODY();

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Test")
	FString name;
};
4 Likes

Hey, you should use

GENERATED_STRUCT_BODY();

Instead of the Classic one :slight_smile:

Wrong way around. GENERATED_BODY is the new version that works with everything, whereas GENERATED_USTRUCT_BODY is the old version.

1 Like

Wow, it solved it! Thank you!

Oh ok, didn’t knew it changed, sorry .

Have you included your generated.h file? If your header was called MyFile.h, then your generated.h file would be MyFile.generated.h and should be the last header you include.

16 Likes

thanks a lot, this fixed the issue and the GENERATED_BODY reply where super usefull :slight_smile:

I have the same problem.
FLocationVideo.h:

#pragma once
#include "CoreMinimal.h"
USTRUCT()
struct GEOVIDEO_API FLocationVideo
{
	GENERATED_BODY();

	UPROPERTY()
	FString Id;
};

FLocationVideo.cpp:
#include "FLocationVideo.generated.h"

Build.cs:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HTTP" });
		PublicDependencyModuleNames.AddRange(new string[] { "Json", "JsonUtilities" });

I’m still getting the following compile error:
'StaticStruct': is not a member of 'FLocationVideo'

What am I missing?

Nevermind, I solved this by changing the FLocationVideo.h and including:
#include "FLocationVideo.generated.h"