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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:37:39+00:00 2026-05-13T05:37:39+00:00

Here is a C++ project, and its lib dependency is Hello.exe -> A.so ->

  • 0

Here is a C++ project, and its lib dependency is

Hello.exe 
   -> A.so 
   -> B.a
B.a 
  -> A.so

Hello.exe depends on B.a and A.so, and B.a depends on A.so.
GCC compiler will link Hello.exe successful?

And if there is a b.cc file in B.a which includes a header file a.h of A.so, and also uses some interfaces of A.so, then with right “include” path setting, compiling b.cc to b.o should be successful.
But if without A.so as input, the link of B.a would be failed, right?

gcc -c b.cc -I../A/include ;; successful 

gcc -a B.a b.o             ;; fail

Where I can find detail library link documents about these complex reference relationship …

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-05-13T05:37:40+00:00Added an answer on May 13, 2026 at 5:37 am

    A static library is just a collection of object files created from compiled .c/.cpp files.
    It cannot have link relationships.

    You will need to specify link dependencies to both A.so and B.a when you compile Hello.exe

    off the top of my head it would be something like

    gcc -o Hello.exe B.a A.so
    

    As a side note you should rename A.so to libA.so and instead do

    gcc -o Hello.exe -lA B.a
    

    Linking to A.so directly like example 1 will require that A.so is always in the same directory as Hello.exe

    If you use example 2, you can put libA.so anywhere and use LD_LIBRARY_PATH to point to the right directory.

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

Sidebar

Related Questions

Here is my project structure: /app --/lib ----/porter.rb --/spec ----/porter_spec.rb In file porter_spec.rb i
I have a project here the goal is to merge multiple Access DB's into
You can see my project here - http://www.inluxphoto.com/custom/jsgallery/index.php I am attempting to make the
I have a bare-bones sample project here: http://dl.dropbox.com/u/7834263/ExpandingCells.zip In this project, a UITableView has
I've downloaded the .zip of this project here: https://github.com/SteveDunn/Gleed2D And I installed Visual Studio
Hey, I'm really stuck with my project here... I need to know when any
I'm working an action for message search in my project,and here are the two
This is my first windows application. I have published my project and here are
Here is my situation: I have a C project linking with many libraries (I
I'm converting a build that has 71 .jar files in its global lib/ directory

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.