When I link a library such as libm in with ld, I need to drop the lib prefix. What if the file does not follow this naming convention? Is there a way to link it other than renaming the file?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can link against any library, e.g.
foo.a, by specifying full path to it on the link line:What you lose with non-standard library name is the ability for the linker to search for it, e.g. this will not work:
You can avoid that lack of search by using
-l:foo.asyntax:Note that in general you should not link anything with
ld. Use the compiler driver instead — it adds objects and libraries to the link line that are required for correct result.