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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

UHT wrongly complains about precompiled header include

I have a source file that I use in multiple projects, and it needs its first #include to be for its precompiled header. My problem is, the precompiled header is different for each of my projects. My solution to this is to add preprocessor directives to change the first #include depending on which project is compiling the file.

   #include "First_Project.h"
   #include "Second_Project.h"

The way that the preprocessor directives are highlighted in Visual Studio shows me that they should be working as expected. However when I compile my VS solution for Project 2 it complains that my first #include is for the file "First_Project.h" which it can't find.

This is a bug in Unreal's build process, as it doesn't consider conditional preprocessor directives when trying to find the first #include in a file.

Product Version: UE 4.10
more ▼

asked Jul 21 '16 at 07:44 PM in Bug Reports

avatar image

427 20 96 123

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

2 answers: sort voted first

Looks like this has already been submitted as a bug report/feature request UE-20145

more ▼

answered Jul 21 '16 at 09:06 PM

avatar image

427 20 96 123

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

It's not compiler but UHT error most likely, it is known that it does ignores conditionals, i seen raport of that in the past

I can think you could work around it by creating header file of same name in both project and make proper include there.

Btw, if you start to use same code over same multiple projects, it means it's time to move it to a plugin where you can easily reuse that code with just one click of a button, that what plugins was made for

more ▼

answered Jul 21 '16 at 08:20 PM

avatar image

36.6k 931 169 1111

avatar image janimationd Jul 21 '16 at 08:33 PM

I don't want to have to make a plugin that encompasses a few files that I would have to recompile separately every 10 minutes or so when I want to test new features. If this feature is not in the UHT then it really should be. The error message I'm getting says:

'C:\Users\WS013\Downloads\UNREAL DEMO\UNREAL DEMO\MyProject\Source\First_Project\AxonPawn.cpp' is trying to include the file 'Second_Project.h' as the precompiled header, but that file could not be located in any of the module's include search paths.

That statement is flat out wrong, I'm not trying to include that file. If nothing else the error message should be updated to say "the first instance of '#include' we found in our plaintext search" rather than "is trying to include the file 'Second_Project.h' as the precompiled header" because the file IS NOT trying to do that.

(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