title: How can I force linking with a static library when a shared library of same name is present
body: <p>Suppose I have a file <code>main.cpp</code> which uses <code>sin()</code> function which is defined in <code>libmath</code>. Also suppose that we have both libmath.a and libmath.so available in the same directory. Now if I issue the command <code>g++ -o main main.cpp -lmath</code> the default behaviour of Linux is to link to the shared library <code>libmath.so</code>. I want to know is there a way to force the program to link with the static library <code>libmath.a</code> without deleting or moving the shared library?</p>