I need to declare a struct to let it be accessed in all my classes and blueprints, i saw and answerhub to this question, and the first answer says this:
“To create global structs I would encourage you to just create a simple header file in your public code, then include that header in your main project header to you will be able to have access to the structs from every where. This way you have visibility in both native code and BluePrints.”
i tried to adding a simple header file from the visual studio, but i’m getting and error when i use the include file in all my classes, i think that is because i didn’t added the header file from the unreal editor using adding c++, what option i need to use to add the simple header file from the unreal editor to let the project identify my c++ header file in the right way ?
sorry if this is a noob question, but i need help.
i need a little help on this, need to declare the global struct, so far i have added the new .h file and include it in the main .h of the game, now i’m tryting to compile the game without adding anything else to the .h file and i’m receiving some errors.
this declaration has no storage class or type specifier Hellrift c:\Users\Administrator\Documents\Unreal Projects\Hellrift\Source\Hellrift\HellriftBase.h 3
expected a ';' Hellrift c:\Users\Administrator\Documents\Unreal Projects\Hellrift\Source\Hellrift\HellriftBase.h 4
Expected a base class name Hellrift C:\Users\Administrator\Documents\Unreal Projects\Hellrift\Source\Hellrift\HellriftBase.h 1
the code that i have in the .h file is this
#pragma once
UCLASS()
class HELLRIFT_API AHellriftBase : public
{
GENERATED_BODY()
};
sorry to write two weeks later but my computer crashed and i spent a week in fixing it.
thank you for your help RPod, that worked, i’m trying to declare the struct, but i checked a lot of info on the forum, answerhub, even youtube, but i can’t figure out why i can’t compile the code when i declare the struct, this is my struct code
i tried to put this code on the c++ .h file that i have created outside of the ue4 editor, also i have tried using that code in the main project .h file, even in others .h from the project, is the same, always get error and don’t build.
i’m receiving an error on the FString line
this declaration has no storage class or type specifier Hellrift c:\Users\Administrator\Documents\Unreal Projects\Hellrift\Source\Hellrift\BaseItem.h 16