title: Xcode linker error: ld: library not found for -twsapi
body: <p>I have compiled and installed a library using Makefile for <code>i386</code> architecture. The library is located in <code>/usr/local/lib/twsapi</code> and the headers are located in <code>/usr/local/include/twsapi</code>.</p>
  
  <p>To use that library in another project I have added <code>libtwsapi.a</code>under Build Settings > Link Binary With Libraries, and added <code>/usr/local/include</code> to the <code>HEADER_SEARCH_PATH</code> variable.</p>
  
  <p>The build process fails during the linking part with the error message <code>ld: library not found for -twsapi</code> even though I have referenced the library. If I remove the link to the binary library I get lots of errors like <code>Undefined symbols for architecture i386:</code>, which makes sense since it cannot find the library in that case. This confirms the library was indeed found in the first place.</p>
  
  <p>Any ideas what's going on? The arguments passed to the linker are shown below:</p>
  
  <pre><code>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ \
    -arch i386 \
    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk \
    -L/Users/morten/Library/Developer/Xcode/DerivedData/test_project-gwzyzroxzbyejngtpizlynumphvo/Build/Products/Debug \
    -L/usr/local/include \
    -L/usr/local/include/twsapi \
    -F/Users/morten/Library/Developer/Xcode/DerivedData/test_project-gwzyzroxzbyejngtpizlynumphvo/Build/Products/Debug \
    -F/usr/local/lib \
    -filelist /Users/morten/Library/Developer/Xcode/DerivedData/test_project-gwzyzroxzbyejngtpizlynumphvo/Build/Intermediates/test_project.build/Debug/test_project.build/Objects-normal/i386/test_project.LinkFileList \
    -mmacosx-version-min=10.9 \
    -stdlib=libc++ \
    -Xlinker \
    -dependency_info \
    -Xlinker /Users/morten/Library/Developer/Xcode/DerivedData/test_project-gwzyzroxzbyejngtpizlynumphvo/Build/Intermediates/test_project.build/Debug/test_project.build/Objects-normal/i386/test_project_dependency_info.dat \
    -o /Users/morten/Library/Developer/Xcode/DerivedData/test_project-gwzyzroxzbyejngtpizlynumphvo/Build/Products/Debug/test_project
  </code></pre>