Re: Xcode compilation order
Re: Xcode compilation order
- Subject: Re: Xcode compilation order
- From: Jens Alfke <email@hidden>
- Date: Wed, 04 May 2016 13:05:56 -0700
> On May 4, 2016, at 11:27 AM, Michael McLaughlin <email@hidden> wrote:
>
> Using Xcode 7.3.0:
>
> I recently created a Cocoa Util class for my OS X Document app and added the files to the project.
>
> I discovered that, even though the new class compiles, one of my existing class source files, Data.mm, does not see the header. Nothing weird here, just
>
> #import Util.h
What does “does not see the header” mean? You haven’t given a clear description of what the actual problem is you’re running into. You should provide exact error messages if possible.
> When looking at the detailed compilation log, I noticed that, if a call is made to a Util method in Data.mm the log shows that Util.m is not compiled before Data.mm. In other cases, Util.m *is* compiled before the source that calls it and the compilation does not fail.
Order of compilation doesn’t matter at all in C-based languages. When compiling a .m (or .mm or .c or .cpp) source file, the compiler doesn’t need to look at other source files, only the headers that are #import’ed or #include’d.
> I tried reordering the compilation in the project Build phases (compiling Util.m first)
That only roughly corresponds to the order of compilation. Xcode compiles multiple source files in parallel (one per CPU core) to keep the CPU busy. And again, the order of compilation shouldn’t matter in the slightest.
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden