Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?


 #pragma once
 #include "LeapFrameData.generated.h"
 struct FLeapFrameData
 public :


 // 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"


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

 <Class definition follows, snipped>

Product Version: Not Selected
more ▼

asked Apr 13 '14 at 12:41 AM in Bug Reports

avatar image

1.5k 55 35 73

avatar image gmpreussner STAFF Apr 13 '14 at 03:19 AM

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!

avatar image twiddle Apr 13 '14 at 03:25 AM

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

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

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Apr 13 '14 at 03:32 AM

avatar image twiddle Apr 13 '14 at 03:49 AM

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.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question