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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:33:01+00:00 2026-06-15T23:33:01+00:00

If I create a static library in C++ in Linux such that a .a

  • 0

If I create a static library in C++ in Linux such that a “.a” file is produced, how do I (or anyone else) use the library? For example, my library defines a class. I assume that it is not sufficient merely to provide the “.a” file, but also to provide a header file. How do I know what header files must be provided with the “.a” file?

For example, do I need to provide all header files that were included anywhere in the code for my library?

  • 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-15T23:33:03+00:00Added an answer on June 15, 2026 at 11:33 pm

    The technical reason for header files is to let the compiler know about names and sizes while compiling user code, so that it can arrange the user object’s layout.

    That is the reason why private member of public classes (note the the emphases: public, here, is not the keyword) must be exposed in headers.

    You can avoid to expose classes that are layed-out in the exposed parts only as pointers or references, since their actual instance will not leave in the resulting user object itself. In that case you can declare just the name.

    You have -in substance- top provide to the user all the declarations that

    • user code needs to access
    • contributes somehow in user objects’s size and composition (even without a user’s direct knowledge).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in general we use ar rcs command to create a static library on unix.
In short: Is there a way to create a static library in Xcode such
I create a static library file and used this in another project and build
I'm using GCC on Linux to create a shared library. The library itself has
I want to create a static library kind of stuff which has to be
I checked out the microsoft documents. it shows how to create a static library
I know that source code can be compiled and linked to shared/static library or
I have a need to create a static library which will some of it's
I followed the following tutorials to create a static library. http://tldp.org/HOWTO/Program-Library-HOWTO/static-libraries.html http://www.adp-gmbh.ch/cpp/gcc/create_lib.html http://www.cs.dartmouth.edu/~campbell/cs50/buildlib.html I
I am trying to create a shared library (really a Python module) that links

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.