title: Swift linking errors in trivial OS X Command Line App
body: <p>I have been using a simple command line app from within Xcode (not directly via swiftc) to test code that otherwise gives Playground fits.  After several months, and compiler updates, I cannot link seem to link a trivial and contrived snippet that extends a Swift Array.  I have code like this in an iOS app, and it compiles just fine.  I must have missed the memo at some point, but I am not sure what that was.</p>
  
  <p>Here is a simple snippet (in a main.swift file) that:</p>
  
  <pre><code>protocol MyProtocol : SequenceType {
      func fubar()
  }
  
  
  extension Array : MyProtocol {
      func fubar() {}
  }
  
  
  println("Hello, World!")
  </code></pre>
  
  <p>That causes a multitude of linking errors like:</p>
  
  <pre><code>Ld /Users/Redacted/Library/Developer/Xcode/DerivedData/Hacks-Redacted/Build/Products/Debug/Hacks normal x86_64
      cd /Users/Redacted/development/tests/Hacks
      export MACOSX_DEPLOYMENT_TARGET=10.10
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/Redacted/Library/Developer/Xcode/DerivedData/Hacks-Redacted/Build/Products/Debug -F/Users/Redacted/Library/Developer/Xcode/DerivedData/Hacks-Redacted/Build/Products/Debug -filelist /Users/Redacted/Library/Developer/Xcode/DerivedData/Hacks-Redacted/Build/Intermediates/Hacks.build/Debug/Hacks.build/Objects-normal/x86_64/Hacks.LinkFileList -mmacosx-version-min=10.10 -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift_static/macosx -Xlinker -force_load_swift_libs -lswiftRuntime -lc++ -framework Foundation -lcurses -Xlinker -add_ast_path -Xlinker /Users/Redacted/Library/Developer/Xcode/DerivedData/Hacks-Redacted/Build/Intermediates/Hacks.build/Debug/Hacks.build/Objects-normal/x86_64/Hacks.swiftmodule -Xlinker -dependency_info -Xlinker /Users/Redacted/Library/Developer/Xcode/DerivedData/Hacks-Redacted/Build/Intermediates/Hacks.build/Debug/Hacks.build/Objects-normal/x86_64/Hacks_dependency_info.dat -o /Users/Redacted/Library/Developer/Xcode/DerivedData/Hacks-Redacted/Build/Products/Debug/Hacks
  
  duplicate symbol __TTWSaSs12SequenceTypeFS_8generateUS__USs13GeneratorType___fRQPS_FT_QS1_9Generator in:
      /Users/Redacted/Library/Developer/Xcode/DerivedData/Hacks-Redacted/Build/Intermediates/Hacks.build/Debug/Hacks.build/Objects-normal/x86_64/main.o
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift_static/macosx/libswiftCore.a(Swift.o)
  duplicate symbol __TTWSaSs12SequenceTypeFS_oi2tgUS__USs13GeneratorType___fMQPS_FTS1_TVSs19_UnderestimateCountT___Si in:
      /Users/Redacted/Library/Developer/Xcode/DerivedData/Hacks-Redacted/Build/Intermediates/Hacks.build/Debug/Hacks.build/Objects-normal/x86_64/main.o
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift_static/macosx/libswiftCore.a(Swift.o)
  
  ... &lt;&gt;
  </code></pre>
  
  <p>Could there be some new linking requirements that I missed?  Seems like it must be something simple, but it is escaping me.  For all it's worth, I have duplicated this on a separate machine and am using Xcode 6.1.1 (6A2008a) - latest as of the time of posting.</p>
  
  <hr>
  
  <p>Edited to clarify that I am attempting to build this with Xcode, not from the command line.</p>