3 Replies
      Latest reply on Dec 8, 2019 7:38 AM by janabanana
      philipd Level 1 Level 1 (0 points)

        Hi,

         

        After upgrading to Xcode 11 (11A420a) compiling objective-C files fails on a line

         

        #import <Cocoa/Cocoa.h>

         

        with this error:

        While building module 'AppKit' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:

        In file included from <module-includes>:1:

        In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:15:

        In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSActionCell.h:8:

        In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:11:

        In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:8:

        In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSView.h:8:

        In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:10:

        In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSResponder.h:10:

        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:267:11: error: non-trivial C types are disallowed in union

                } key;

                  ^

        1 error generated.

         

        what has changed and how to solve it?

         

        thanks

        • Re: Objective-C compilation failure after Xcode 11 update
          eskimo Apple Staff Apple Staff (12,675 points)

          Huh?  All of the paths in that error message are within the 10.11 SDK.  Xcode 11 only ships with, and only supports, the 10.15 SDK.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: Objective-C compilation failure after Xcode 11 update
              kdeda Level 1 Level 1 (0 points)

              Decided to update to Xcode 11.0 (11A420a) this morning ... (i'm on 10.14.6)

              Project builds, runs fine

              IDDAppKit is my framework to share swift/obj-c code

              It has been working so far (it still works)

               

              But the following is printed in the gdb console.

              Strange !!!

              ---

               

              warning: Swift error in scratch context: <module-includes>:1:9: note: in file included from <module-includes>:1:

              #import "Headers/IDDAppKit.h"

                      ^

              error: /Users/kdeda/Development/git.id-design.com/iddappkit/IDDAppKit/IDDAppKit/IDDAppKit.h:13:9: error: 'Cocoa/Cocoa.h' file not found

              #import <Cocoa/Cocoa.h>

                      ^

              /Users/kdeda/Development/git.id-design.com/iddappkit/IDDAppKit/IDDAppKit/IDDAppKit.h:13:9: note: did not find header 'Cocoa.h' in framework 'Cocoa' (loaded from '/System/Library/Frameworks')

              #import <Cocoa/Cocoa.h>

                      ^

              error: could not build Objective-C module 'IDDAppKit'

               

              note: This error message is displayed only once. If the error displayed above is due to conflicting search paths to Clang modules in different images of the debugged executable, this can slow down debugging of Swift code significantly, since a fresh Swift context has to be created every time a conflict is encountered.

               

               

              5591

                • Re: Objective-C compilation failure after Xcode 11 update
                  janabanana Level 1 Level 1 (0 points)

                  I don't know if what I am about to describe pertains to your situation but here is something I have found: 

                   

                  When I am building an app, I often create groups to reduce the clutter and then as I build and expand the app, I drag certain headers and methods into newly created groups.  This worked fine in the past but XCode 11 doesn't like this.  I would get errors that header files could not be found yet the app would build and run properly.  The solution, by trial and error, was to drag all of the headers and methods out of the groups, put them in the root folder of the app, and delete the now empty groups.  Then, to create the groups I wanted, I selected certain headers and methods and created a group with selection.  This solved all my wonky errors of not being able to find some headers.