title: ld: library not found
body: <p>I'm trying to build a project that depends on SDL2 library. I've installed and linked it using homebrew:</p>
  
  <pre><code>&gt; ls /usr/local/lib | grep SDL2
  libSDL2-2.0.0.dylib
  libSDL2.a
  libSDL2.dylib
  libSDL2_test.a
  libSDL2main.a
  </code></pre>
  
  <p>I also added <code>/usr/local/lib</code> to my <code>/etc/paths</code> and <code>~/.bash_profile</code> as well:</p>
  
  <pre><code>&gt; cat /etc/paths
  /usr/local/lib
  /usr/local/bin
  /usr/bin
  /bin
  /usr/sbin
  /sbin
  </code></pre>
  
  <p>However, when I try to build the project, I still get this error:</p>
  
  <pre><code>error: linking with `cc` failed: exit code: 1
  note: cc '-m64' '-L' (...) '-lSDL2'
  ld: library not found for -lSDL2
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Why does it happen and how can I fix it?</p>