Cucharon
(Cucharón)
December 15, 2018, 11:27am
1
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
Firefly74
(Firefly74)
December 15, 2018, 12:24pm
2
Hey, you should use
GENERATED_STRUCT_BODY();
Instead of the Classic one
Jamie_Dale
(Jamie Dale)
December 15, 2018, 12:38pm
3
Wrong way around. GENERATED_BODY
is the new version that works with everything, whereas GENERATED_USTRUCT_BODY
is the old version.
1 Like
Cucharon
(Cucharón)
December 15, 2018, 1:02pm
4
Wow, it solved it! Thank you!
Firefly74
(Firefly74)
December 15, 2018, 1:06pm
5
Oh ok, didn’t knew it changed, sorry .
Jamie_Dale
(Jamie Dale)
December 15, 2018, 12:31pm
6
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
Jamie Dale:
MyFile
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"