Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7826225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:18:39+00:00 2026-06-02T09:18:39+00:00

When I link a library such as libm in with ld, I need to

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:18:40+00:00Added an answer on June 2, 2026 at 9:18 am

    You can link against any library, e.g. foo.a, by specifying full path to it on the link line:

    gcc main.o /path/to/foo.a
    

    What you lose with non-standard library name is the ability for the linker to search for it, e.g. this will not work:

    gcc main.o -L/path/to foo.a
    

    You can avoid that lack of search by using -l:foo.a syntax:

    gcc main.o -L/path/one -L/path/two -l:foo.a
    

    When I link a library such as libm in with ld

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's a #pragma command to link in a library from the source file rather
I have created a static library following this link . But I am facing
I am aware of this question , but it does not appear to work
Is it correct to link a static library (.lib) compiled with VS 2005 with
link text This is a link from a digital book library.There are forward and
I'm finding it really difficult to properly link a .lib file to my C++
Just reading this link: http://msdn.microsoft.com/en-us/library/aa833199.aspx It states: You cannot add users to roles in
The problem below is ralated to my previous question Converting static link library to
I use LIBS flag to link qwt library to my project. So in .pro
Is it possible to link a static library built with VS2005 into an application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.