Header-only USTRUCT referenced in module's PrivatePCH not detected by UBT

So I’m trying to define a USTRUCT inside its own header file (LeapFrameData.h) and then reference that type inside the header for a seperate UCLASS (LeapInputComponent) inside a plugin module.

Regardless of where I place LeapFrameData.h, inside Private/ or Classes/, I have to manually #include that header in LeapInputComponent.h, even though LeapBlueprintSupportPrivatePCH.h already includes it and is present in LeapInputComponent.h (It’s commented out in the below sample code). If that line is commented or missing then I get the following error from UBT:

Classes/LeapInputComponent.h(10): error : In LeapInputComponent: Unrecognized type 'FLeapFrameData'

LeapFrameData.generated.h is not generated in this scenario, either.

My understanding was we should put module-wide header files inside the *PrivatePCH file for the module (certainly the comments in the sample plugin indicate as much). If that’s the case, I surely shouldn’t also be having to manually #include it into a header that needs it, I should just be able to use PrivatePCH instead?

LeapFrameData.h

#pragma once
#include "LeapFrameData.generated.h"
USTRUCT()
struct FLeapFrameData
{
public :
	GENERATED_USTRUCT_BODY()
};

LeapBlueprintSupportPrivatePCH.h

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "CoreUObject.h"
#include "Engine.h"
#include "Core.h"
#include "ILeapBlueprintSupport.h"
#include "LeapFunctionLibrary.h"
#include "LeapInputComponent.h"
#include "LeapFrameData.h"
#include "Leap.h"

LeapInputComponent.h

#pragma once
#include "LeapBlueprintSupportPrivatePCH.h"
//#include "LeapFrameData.h" 
#include "LeapInputComponent.generated.h"

<Class definition follows, snipped>

I am not 100% whether this is still the case, but we used to have a limitation in UHT that required at least one UCLASS to be present in the module in order for USTRUCTS to be picked up. If I remember correctly, it had been fixed not too long ago, but maybe it’s still broken, or it’s a regression.

Can you please try to put an empty UCLASS into your module? For example, take a look at USessionServiceMessages in SessionServiceMessages.h to see what I’m doing there, and let me know if that works for you, thanks!

Ah, my LeapInputComponent.h does actually define a UCLASS.

Full (not snipped this time) contents of the file are now in the OP.

Ok, there are a couple issues here…

  1. LeapFrameData.h should be included before LeapInputComponent.h, because the latter depends on the former
  2. LeapInputComponent.h should not include LeapBlueprintSupportPrivatePCH.h. Pre-compiled header files are meant to be included in compilation units, i.e. .cpp files
  3. You should probably move the implementation of your LeapInputComponent class into LeapInputComponent.cpp, then include the pre-compiled header file there.

I did already have a LeapInputComponent.cpp defining a constructor etc which was including the PCH, so I moved the implementation of the handler function over as well as making the changes you’ve mentioned.
Your suggestions seem to have sorted the issue. I suspect it was simply the ordering of the #include files inside the PCH - a bit of a rookie error on my part.
Marking this as resolved for now. Thankyou for the speedy assistance.