domzorg
(domzorg)
November 20, 2015, 1:37pm
1
I have a strange bug with the HeaderTool.
I’ve go a simple widget style class.
USTRUCT()
struct KSGM_API FKLobbyWidgetStyle : public FSlateWidgetStyle
{
GENERATED_USTRUCT_BODY()
When I try to compile I received the following message from HeaderParser.cpp
/KLobbyWidgetStyle.h(26) : struct: ‘KLobbyWidgetStyle’ conflicts with class name
I’ve checked in the HeaderParser.cpp
// Verify uniqueness (if declared within UClass).
{
auto* Existing = Scope->FindTypeByName(*EffectiveStructName);
if (Existing)
{
FError::Throwf(TEXT("struct: '%s' already defined here"), *EffectiveStructName);
}
if (FindObject<UStruct>(ANY_PACKAGE, *EffectiveStructName) != NULL)
{
FError::Throwf(TEXT("struct: '%s' conflicts with class name"), *EffectiveStructName);
}
}
This new struct exists only in this file.
If I change the struct name FKLobbyWidgetStyle to FKLobbyStyle
no more error.
I don’t know how the parser can find a similar UStruct in ANY_PACKAGE.
D.
Hey -
The issue is that the name of the struct matches the name of your class. This is why changing the name of the struct removes the error.
Cheers
domzorg
(domzorg)
November 22, 2015, 6:51am
3
Hello ,
Yes but I have no class with the name FKLobbyWidgetStyle.
But may be I don’t understand. What class are you talking about ?
D.
The F is seen as an identifier at the beginning of the name rather than part of the name. For example, I created a class named MyActor (AMyActor in VS), attempting to add a UStruct called UMyActor gave the same error that you posted above. If you have a class named KLobbyWidgetStyle (either actor, object, character, etc) then this is the likely cause of the error.
domzorg
(domzorg)
November 25, 2015, 10:12am
5
Ok.
In fact I understood the problem.
The style class is named :
UCLASS(hidecategories = Object, MinimalAPI)
class UKLobbyWidgetStyle : public USlateWidgetStyleContainerBase
Then effectively, it gives that error.
Many thanks for your help,
Have a nice day,
D.