You'll need to create a module map to import C modules. In practise it'll be easier to use swiftpm for such things. I had written a tutorial for this :<div><br></div><div><a href="http://ankit.im/swift/2015/12/27/ship-c-code-with-swift-packages-using-swift-package-manager/">http://ankit.im/swift/2015/12/27/ship-c-code-with-swift-packages-using-swift-package-manager/</a><br><br>On Friday 29 January 2016, Suipengfei via swift-users <<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="ZH-CN" link="blue" vlink="purple">
<div>
<p><span lang="EN-US">Hi all, I want to make a simple emample to show swift can call c library.
<u></u><u></u></span></p>
<p><span lang="EN-US"><u></u> <u></u></span></p>
<p><span lang="EN-US">So ,I make a simple example,like this:<u></u><u></u></span></p>
<p><span lang="EN-US"><u></u> <u></u></span></p>
<p><span lang="EN-US">$ cat a.c<u></u><u></u></span></p>
<p><span lang="EN-US">int add(int a,int b){<u></u><u></u></span></p>
<p><span lang="EN-US"> return a + b;<u></u><u></u></span></p>
<p><span lang="EN-US">}<u></u><u></u></span></p>
<p><span lang="EN-US"><u></u> <u></u></span></p>
<p><span lang="EN-US">And I make a lib,<u></u><u></u></span></p>
<p><span lang="EN-US">$ gcc -o a.o -c a.c<u></u><u></u></span></p>
<p><span lang="EN-US">$ ar rcs libmylib.a a.o<u></u><u></u></span></p>
<p><span lang="EN-US"><u></u> <u></u></span></p>
<p><span lang="EN-US">And I put libmylib.a in the same director with the main.swift
<u></u><u></u></span></p>
<p><span lang="EN-US"><u></u> <u></u></span></p>
<p><span lang="EN-US">$ cat main.swift<u></u><u></u></span></p>
<p><span lang="EN-US">import mylib<u></u><u></u></span></p>
<p><span lang="EN-US">var b = add(10,20)<u></u><u></u></span></p>
<p><span lang="EN-US">print(b)<u></u><u></u></span></p>
<p><span lang="EN-US"><u></u> <u></u></span></p>
<p><span lang="EN-US">when I compile : <u></u><u></u></span></p>
<p><span lang="EN-US">$ swiftc main.swift<u></u><u></u></span></p>
<p><span lang="EN-US">main.swift:1:8: error: no such module 'mylib'<u></u><u></u></span></p>
<p><span lang="EN-US">import mylib<u></u><u></u></span></p>
<p><span lang="EN-US"> ^<u></u><u></u></span></p>
<p><span lang="EN-US"><u></u> <u></u></span></p>
<p><span lang="EN-US"><u></u> <u></u></span></p>
<p><span lang="EN-US">I am just confused with this. Can you explain that with you pressure time. And what should I do? Thank you a lot ~<u></u><u></u></span></p>
<p><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
</div>
</blockquote></div><br><br>-- <br>Ankit<br><br><br>