How to set default path for swiftc without using xcrun -sdk macosx

Yosemite 10.10.3:

import Foundation
println("Hello, World")

      

swiftc -o out in.swift , result:

error: cannot load base module for "CoreGraphics" on my desktop, but compiles and works on my laptop. The SDKROOT environment variable is not set on any machine. I don't know why this code will compile on my laptop but not on my desktop. Obviously, it has been found that swiftc can find the CoreGraphics module on my laptop, but not on my desktop.

xcrun -sdk macosx swiftc -o out in.swift will compile the code on the desktop. I was asked to explain why it is important that I be able to control the former and why I cannot just launch the latter and forget about it; I have no answer other than my own curiosity to understand how and why everything works so that I can master a computer, not the other way around. Also, it's quite a bit shorter to type.

+3


source to share


1 answer


Not really an answer, but you can of course save yourself by adding this alias to your ~ / .bashrc



alias sc='xcrun -sdk macosx swiftc'

      

+1


source







All Articles