Reputation: 5277
I have a working swift script that I want to compile as an executable.
When I execute
swiftc create-event-in-calendar.swift -F /System/Library/Frameworks -o create-event-in-calendar
I get all sorts or compile errors like
<unknown>:0: error: could not build Objective-C module 'CoreFoundation'
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h"
^
/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:10: note: in file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:
#include <CoreGraphics/CGBase.h>
What do I need to do to compile the swift script?
Upvotes: 2
Views: 588
Reputation: 5277
Turned out to be pretty simple. Add xcrun -sdk macosx at the start of the command line.
xcrun -sdk macosx swiftc create-event-in-calendar.swift -o create-event-in-calendar
Upvotes: 2