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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:01:49+00:00 2026-05-13T12:01:49+00:00

In my quest to learn C++, I have come across dynamic and static libraries.

  • 0

In my quest to learn C++, I have come across dynamic and static libraries.

I generally get the gist of them: compiled code to include into other programs.

However, I would like to know a few things about them:

  • Is writing them any different than a normal C++ program, minus the main() function?
  • How does the compiled program get to be a library? It’s obviously not an executable, so how do I turn, say ‘test.cpp’ into ‘test.dll’?
  • Once I get it to its format, how do I include it in another program?
  • Is there a standard place to put them, so that whatever compilers/linkers need them can find them easily?
  • What is the difference (technically and practically) between a dynamic and static library?
  • How would I use third party libraries in my code (I’m staring at .dylib and .a files for the MySql C++ Connector)

Everything I have found relating to libraries seems to be targeting those who already know how to use them. I, however, don’t. (But would like to!)

Thanks!

(I should also note I’m using Mac OS X, and although would prefer to remain IDE-neutral or command-line oriented, I use QtCreator/Netbeans)

  • 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-13T12:01:49+00:00Added an answer on May 13, 2026 at 12:01 pm

    Is writing them any different than a normal C++ program, minus the main() function?

    No.

    How does the compiled program get to be a library? It’s obviously not an executable, so how do I turn, say ‘test.cpp’ into ‘test.dll’?

    Pass the -dynamiclib flag when you’re compiling. (The name of the result is still by default a.out. On Mac OS X you should name your dynamic libraries as lib***.dylib, and on Linux, lib***.so (shared objects))

    Once I get it to its format, how do I include it in another program?

    First, make a header file so the the other program can #include to know what functions can be used in your dylib.

    Second, link to your dylib. If your dylib is named as libblah.dylib, you pass the -lblah flag to gcc.

    Is there a standard place to put them, so that whatever compilers/linkers need them can find them easily?

    /usr/lib or /usr/local/lib.

    What is the difference (technically and practically) between a dynamic and static library?

    Basically, for a static lib, the whole library is embedded into the file it “links” to.

    How would I use third party libraries in my code (I’m staring at .dylib and .a files for the MySql C++ Connector)

    See the 3rd answer.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When two selectors address the same element, you write them… May 13, 2026 at 2:01 pm
  • Editorial Team
    Editorial Team added an answer I found what this issue was, in the schema.xml file… May 13, 2026 at 2:01 pm
  • Editorial Team
    Editorial Team added an answer One approach is to do an IF EXISTS first: IF… May 13, 2026 at 2:01 pm

Related Questions

In my quest to learn javascript (which seems to be my latest source of
In my quest in trying to learn more about OOP in PHP. I have
On my quest to learn NHibernate I have reached the next hurdle; how should
I think I've become quite good at the basics of programming (for a variety
I am new to Python and new to SciPy libraries. I wanted to take

Trending Tags

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

Top Members

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.