Suppose I have a file main.cpp which uses sin() function which is defined in libmath. Also suppose that we have both libmath.a and lib
main.cpp
sin()
libmath
If your linker supports -l: you may use:
-l:
g++ -o main main.cpp -l:libmath.a