1

I've got an Xcode project with the following file structure:

MyPlugin.xcodeproject
    sdk.xcconfig
    MyPlugin.c
    MyPlugin.swift
    MyPlugin-Bridging-Header.h

If I remove MyPlugin.swift from the target, everything compiles fine. Adding it to the target outputs the following error:

Swift Compiler Error: 'Files.h' file not found

The contents of MyPlugin-Bridging-Header.h is simply:

#include "sdk.h"

That sdk.h is being found correctly in the search paths, however it has the following line which is where the error is occurring.

#include <Files.h>

Everything I've searched for has mentioned creating a module.modulemap file so I've have tried that with the following, but it doesn't fix the error:

module Files [system] {
    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/Files.h"
    export *
}

I'm currently wondering whether this modulemap will work if the #include statement I'm trying to fix is within the sdk.h rather than directly in the bridging header?

Additional set up info:

Xcode 10, Swift 4.2, Deployment target: 10.9, Architectures: x86_64

Doug
  • 2,972
  • 3
  • 22
  • 28
  • Are you creating an executable or a framework with this project? Frameworks don't support ObjC bridging headers is why I ask. – bscothern Oct 30 '18 at 20:00
  • Neither, it’s compiling to a Loadable Bundle (or Plug-in, not sure official terminology). Where would I look to check if they support bridging headers @bscothern ? – Doug Oct 31 '18 at 21:29
  • 1
    I haven't ever created one of those. Sadly the documentation over [here](https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift) is lacking anything beyond using it in "apps" and "frameworks". Have you set the modulemap path in your xcconfig/xcodeproject? I'll dig into Loadable Bundles a bit and see if I can learn anything to help. (Sorry stack overflow comments are a pain to format sometimes...) – bscothern Nov 01 '18 at 18:33
  • I've set it in the xcodeproject, not the xcconfig. Just tried it in the xccondig (via a copy and paste from the xcodeproject and it didn't seem to help, but I've never used one of those before. I could upload the project to GitHub if that helps, although not very StackOverflow style doing that? – Doug Nov 04 '18 at 16:53
  • If you are able to upload it somewhere I am happy to spend some more time looking at it to see if I can help you figure it out. – bscothern Nov 08 '18 at 17:16
  • That would be amazing @bscothern thanks I've forked the SDK on GitHub and added my changes to one of the examples here: https://github.com/pixlwave/max-sdk/tree/master/source/basics/simplemax – Doug Nov 18 '18 at 14:38

0 Answers0