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"

What are the differences in c++ include behavior between iOS and Windows?

We're having difficulties maintaining a working iOS build, because there are C++ compile errors that only manifest within an iOS compile chain.

It seems like there are differences in either the headers that are included, or in the effects of their inclusion between a Windows build and an iOS build of our project. I want to understand what causes these differences, and, more importantly, exactly what the differences are. So that we can hopefully come up with a strategy to avoid regularly causing iOS build problems when working in Windows.

As a micro example of the problem, I made a new blank project, and added a single new C++ Actor class. In the header for this class I added a public "FCollisionShape MyCollisionShape;" variable to its class definition. No other changes.

This compiles fine for Windows builds but does not compile if I try to make an iOS build (I am remote building on a Mac):

 UATHelper: Packaging (iOS):     C:\Program Files\Epic Games\UE_4.18(18,2): error: unknown type name 'FCollisionShape'; did you mean 'ECollisionChannel'?
 UATHelper: Packaging (iOS):   
 UATHelper: Packaging (iOS):           FCollisionShape MyCollisionShape;
 UATHelper: Packaging (iOS):   
 UATHelper: Packaging (iOS):           ^~~~~~~~~~~~~~~

Now, this example is easy enough to resolve by explicitly including WorldCollision.h, but after our team has worked exclusively on Windows for a few days we can easily have a large number of related errors, because they didn't show up in general development.

What I really want to understand is what the exact difference in include behavior is between the two platforms, and ideally, why this difference exists. If you are able to go further, and make suggestions on how we might avoid this flavor of platform specific compile errors in the future, we would be keen to hear them!



Product Version: UE 4.18
more ▼

asked Feb 12 '18 at 05:34 PM in C++ Programming

avatar image

6 1

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

1 answer: sort voted first

Okay, thankfully a colleague was able to put me on the right track.

It turns out the difference is "unity build", which is enabled by default in Windows builds, and (presumably) disabled by default in (at least) remote iOS builds.

Unity build is a 'clever' trick that concatenates multiple .cpp files into one before compilation, in order to speed up compilation times. I say 'clever' because it can/does hide legitimate code bugs like my questions example.

To bring the two builds inline (which I consider a must, even if at the expense of a slower compile) you need to disable unity build. See https://forums.unrealengine.com/development-discussion/engine-source-github/121146-how-to-compile-in-non-unity-mode?p=1047662#post1047662 for an explanation on how to do that.

fwiw, I strongly believe features like unity build, which give a speedup at the expense of 'accurate' compilation should be default-off

more ▼

answered Feb 13 '18 at 12:18 AM

avatar image

6 1

(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