<div dir="ltr">Hi all,<div><br></div><div>I&#39;d like to create my own simple custom module, but I don&#39;t want to use the complicated package manager. Package manager is overkill for a simple single source file module. So, here&#39;s what I&#39;ve tried.</div><div><br></div><div>file: greet.swift</div><div><br></div><div><div>public func askName() {</div><div><span class="" style="white-space:pre">        </span>print(&quot;What&#39;s your name? &quot;)</div><div><span class="" style="white-space:pre">        </span>let name = readLine()!</div><div><span class="" style="white-space:pre">        </span>print(&quot;Hello, \(name)... good to see you!&quot;)</div><div>}</div></div><div><div><br></div><div>file: main.swift</div><div><br></div><div>askName()<br></div><div><br></div><div>terminal:</div><div><br></div><div>$ swiftc -emit-library -emit-object greet.swift -module-name greet <br></div><div><br></div><div>emits greet.o</div><div><br></div><div>$ ar rcs libgreet.a greet.o<br></div><div><br></div><div>emits libgreet.a</div><div><br></div><div>$ swiftc -emit-module greet.swift -module-name greet   <br></div><div><br></div><div>emits greet.swiftmodule and greet.swiftdoc</div><div><br></div><div>All went well, so I think now I already have had the &quot;greet&quot; module. Let&#39;s try to use it…</div><div><br></div><div>file: test.swift</div><div><br></div><div><div>import greet</div><div>askName()</div></div><div><br></div><div>terminal:</div><div><br></div><div><div><div>$ swiftc test.swift </div><div>clang: warning: argument unused during compilation: &#39;-F/home/username&#39;</div><div>/tmp/test-b63aab.o: In function `main&#39;:</div><div>/tmp/test-b63aab.o:(.text+0x41): undefined reference to `_TF5greet7askNameFT_T_&#39;</div><div>clang: error: linker command failed with exit code 1 (use -v to see invocation)</div><div>&lt;unknown&gt;:0: error: link command failed with exit code 1 (use -v to see invocation)</div></div></div><div><br></div><div>What&#39;s happening? What&#39;s wrong? How can I fix it?</div><div><br></div><div>Thank you.</div><div><br></div><div>Regards,</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>-Bee-<br><br></div></div></div>
</div></div>