title: How to merge two static libraries into single shared library
body: <p>As part of my learning, I am trying to merge two static libraries into single shared library. Following sequence of commands I am using to prepare static libraries</p>
  <blockquote>
  <p>$gcc -c mathutil.cpp -o mathutil.o</p>
  <p>$ar rcs libmathutil.a mathutil.o</p>
  <p>$gcc -c dateutil.cpp -o dateutil.o</p>
  <p>$ar rcs libdateutil.a dateutil.o</p>
  </blockquote>
  <p>Could somebody please tell me how to merge these two static libraries into single shared library.</p>
  <p>I have tried the following command</p>
  <blockquote>
  <p>gcc -Wl,--whole-archive -shared libutil.so libmathutil.a</p>
  </blockquote>
  <p>But it is giving lot of multiple definition errors.</p>