title: Undefined symbols in a shared library compiled with a static library
body: <p>I have a problem with linking together different libraries using it in one executable project.</p>
  
  <p>Let's say Project A contains a function named <code>foo()</code>; It is compiled as a static library.<br>
  Project B contains a function named <code>bar()</code>, includes a header from A and compiled as a shared library with <code>-Wl</code>,<code>--whole-archive libA.a -Wl</code>,<code>--no-whole-archive flags</code>. <br>libB.so was moved to <code>/usr/lib</code>.</p>
  
  <p>Now, project C includes <code>B.h</code>, calls <code>bar()</code>, but wasn't compiled due to the reason of undefined reference to <code>foo()</code> function, which was defined in project A.</p>
  
  <p>nm <code>libB.so</code> says:<br></p>
  
  <pre><code>U foo
  </code></pre>
  
  <p>I am using gcc, the programming language is C, the IDE is Eclipse CDT.</p>
  
  <p>Is anyone who has an idea or tip to solve this problem? </p>
  
  <p>Thank you.</p>