x

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"

Can inline files (.inl) be included from a UE4 header file?

I'm trying to include an inline definition file (.inl), which of course needs to be included in the header after the class declaration. However UHT of course throws an error because its .generated header wasn't included last.

 error : #include found after .generated.h file - the .generated.h file should always be the last #include in a header

Is there any way to coerce UHT into letting this additional include go? (This error seems to be the result of a superfluous check which although helpful is not strictly required).

  • Maybe there's a UHT-equivelent of #pragma ignore?

  • Is it maybe possible to turn off this specific warning globally in UHT?

I realise that "tactically" I could simply put the inline definitions back into the header file, however this is a standard practice of working in C++; I'd really expect should be supported out-of-the-box. The reason why I'm doing it is that this specific file has a beefy set of inline method definitions, which really need to be broken out.

 #pragma once
 #include "ActorClass.generated.h"      // <-- Generated file needs to be last for UHT
 
 UCLASS()
 class CHESS_API AActorClass : public AActor
 {
     GENERATED_BODY()
 
     // ... declaration ...
 };
 
 #include "ActorClass.inl"     // <- Inline definition file needs to be included *after* the declaration for the compiler
Product Version: UE 4.16
Tags:
more ▼

asked Jun 21 '17 at 01:56 PM in C++ Programming

avatar image

DerPurpelHelmut
526 8 12 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

If you find yourself in the same position as me then here's the answer. Surround the inline in an #if CPP preprocessor directive:

 #if CPP
 #include "MyFile.inl"
 #endif

This way, it's ignored by UHT, but picked up by the compiler.

more ▼

answered Jun 21 '17 at 02:43 PM

avatar image

DerPurpelHelmut
526 8 12 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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