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 libmath.so available in the same directory. Now if I issue the command g++ -o main main.cpp -lmath the default behaviour of Linux is to link to the shared library libmath.so. I want to know is there a way to force the program to link with the static library libmath.a without deleting or moving the shared library?
-
2Possible duplicate of g++ linker: force static linking if static library exists?John_West– John_West2016-04-05 13:08:48 +00:00Commented Apr 5, 2016 at 13:08
Add a comment
|