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 965639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:01:53+00:00 2026-05-16T02:01:53+00:00

If I compile my source code with -L. the dynamic library libmd5.so can be

  • 0

If I compile my source code with “-L.” the dynamic library libmd5.so can be found.

gcc main.c -g -O2 -Wall -o main -L. -lmd5 -lcr

But if I leave the “-L.”-option away, the linker does not find the dynamic library. How can I change that without having to invoke “-L.”?

(additional info libmd5.so and libmd5.so.1.0.1 are located in /home/user/ba)

  • 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-05-16T02:01:54+00:00Added an answer on May 16, 2026 at 2:01 am

    There’s really nothing wrong with the -L flag, so you shouldn’t try so hard to get rid of it – is it at runtime you have problems, as the system won’t load the libraries you link to ? Here’s some options :

    • Add /home/user/ba to /etc/ld.so.conf (or similar for your OS) and run ldconfig afterwards. This will be system wide.
    • Set the LIBRARY_PATH(for link time) and LD_LIBRARY_PATH(for run time) environment variable. export LD_LIBRARY_PATH=/home/user/ba and export LIBRARY_PATH=/home/user/ba .This will have effect only for the current shell.
    • Set the rpath in the executable (you still need the -L . here though). Add -L /home/user/ba -Wl,-rpath,/home/user/ba to your linker flags. This will have effect only for the executable you’re making.
    • Place your shared libraries in a system wide library search path such as /usr/lib. This will be system wide.

    The above have effect at runtime as well – it’ll try to find libmd5.so in /home/user/ba or other library search paths for the system when you run the app as well.

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

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use SHOW OPEN TABLES to show each table's… May 16, 2026 at 9:12 am
  • Editorial Team
    Editorial Team added an answer I agree that a spell-checker should be native if it's… May 16, 2026 at 9:12 am
  • Editorial Team
    Editorial Team added an answer The most similar language to C# from your list is… May 16, 2026 at 9:12 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

This is a follow-up to Dynamic Shared Library compilation with g++ . I'm trying
I've compiled a DLL in Visual Studio (the source code is in C++, which
I am wanting to write some cross-platform library code. I am creating a library
According to this reference for operator new : Global dynamic storage operator functions are
I'm having problems compiling an open source C++ project on Fedora. When I download
I've taken a library that is distributed as a binary lib (.a) and header,
I have a very dynamic SQL Server problem to solve. I am developing a
Following techniques from 'Modern C++ Design', I am implementing a persistence library with various
I used to program in Windows with Microsoft Visual C++ and I need to

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.