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

  • SEARCH
  • Home
  • 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 8900029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:00:17+00:00 2026-06-15T01:00:17+00:00

I use gcc more than any other compiler, so I will shape my example

  • 0

I use gcc more than any other compiler, so I will shape my example with this compiler suite, but i have experienced this problem with almost all the suite that i have tried like gcc, mingw, clang and msvc.

gcc offers this flags:

  • -l you write the name foo, gcc will find a corrisponding library named libfoo
  • -L you append the path where the libs lives and gcc tries to match the required libraries to the ones that it finds in that path
  • -rpath basically a pool of different path for the same lib so the executable is “smart” enough to look for alternatives if he needs one.

the problem is big for me, no one of this solves my problem and each one of this flags suffer the same problem: ambiguity.

if I just want to link a library that i know there is no way to do this without including a dose of ambiguity in the best case scenario, what i want is:

  • linking 1 specific library only, and only the 1 that I specify with a precise name and path
  • avoid auto-completion mechanism like the one on the name given to -l because my libs are named foo.so not libfoo.so
  • relative path for the linked libs
  • only consider the explicitly given set of libraries, no other automation of any kind should be involved, no pool of libs, no search-paths, no nothing else, I prefer list of errors instead of an executable linked to a random library

I often deal with different libs in different releases, they often share the same name for historical and compatibility reasons, it’s a nightmare compiling and linking with gcc because I never got the one that I want linked to my executable.

Thanks.

  • 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-15T01:00:19+00:00Added an answer on June 15, 2026 at 1:00 am

    The easiest way to do this is to simply specify the library.

    gcc -o test test.o /path/my_library.so /path/to_other_library.a

    The obvious downside to this approach if of course that if you move that library then your application won’t work anymore but since you state that you have the libraries at fixed locations it should work in your case.

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

Sidebar

Related Questions

What windows C IDE can I use that will use gcc to compile and
Can I configure the VS.NET 2008 IDE to use gcc as a compiler?
I have a c-library which I use in gcc. The library has the extension
I have look-up-table as defined below and I'm making use of GCC. When I
I use Ubuntu(Linux)+ gcc as a example. stdio.h sys/socket.h poll.h pthread.h which on Ubuntu
With gcc versions before 3.3 and with the MS compiler I use the following
I want to have named fields rather than indexed fields, but for some usage
I use Freebsd 8.0 amd64,mysql-client-5.1.61, mysql-connector-c++-1.1.0, mysql-server-5.1.61 and gcc 4.2.1 Whay this is working
For some reason, I should use gcc to compile a C file, then link
Can I force the gcc to use a null canary or terminator canary, when

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.