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"

Precompiled header includes break in 4.15

Hi. I have a plugin I have to maintain for several versions of UE. I tried to compile it today for 4.15, as one of the projects I have to support will soon start migrating to it.
The problem I have is that, in 4.14 and previous, UBT required the first include in every cpp to be the PCH for the plugin, whereas in 4.15, UBT requires the first included file to be the header file corresponding to the cpp file (i.e., "foo.h" for "foo.cpp"). This is clearly incompatible.
Is there any way to remove that requirement via the Build.cs file or similar? Or can the corresponding errors be turned to warnings? Otherwise the only alternative I see is ifdef-ing all the includes, which is a bit tiresome (and pretty ugly, IMHO).

Product Version: UE 4.15 Preview
more ▼

asked Feb 08 '17 at 06:08 AM in C++ Programming

avatar image

322 10 4 13

avatar image Muelas.Aitzol Feb 08 '17 at 06:25 AM

Hi, update: I just tried to ifdef

 #include "FooPluginPCH.h"
 #include "Foo.h"

And UBT is still complaining that the first include must be "Foo.h". :'(

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

2 answers: sort voted first

Hi, after much fiddling and looking at UBT source, i managed to fix it by adding the following to the module's Build.cs file:

 PCHUsage = PCHUsageMode.NoSharedPCHs;

Now it prints a warning when generating the VS project, but everything is building/working fine!
Thanks anyway :)

more ▼

answered Feb 13 '17 at 09:39 AM

avatar image

322 10 4 13

avatar image antithing Mar 01 '17 at 03:17 PM

Hi, I am struggling with updating plugins also. When I try your fix, i get:

Error CS0103 The name 'PCHUsage ' does not exist in the current context

Did this work for you? Thanks!

avatar image Muelas.Aitzol Mar 02 '17 at 02:43 AM

Hi, sorry, I should have written the full code (PCHUsage is a property of ModuleRules):

 using System.IO;
 namespace UnrealBuildTool.Rules
     public class ExamplePlugin : ModuleRules
         public ExamplePlugin(TargetInfo Target)
             // This prevents UBT from complaining when it finds module PCH before class header
             PCHUsage = PCHUsageMode.NoSharedPCHs;
             // rest of rules
             // ...

This works for me in UE 4.11 to 4.15. Hope it helps!

avatar image antithing Mar 02 '17 at 10:10 AM

Thank you! Much appreciated.

(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