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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:51:30+00:00 2026-05-16T09:51:30+00:00

I’m building static libraries (right now libpng ) in Microsoft Visual Studio 2008 SP1.

  • 0

I’m building static libraries (right now libpng) in Microsoft Visual Studio 2008 SP1.

Do I have any possibility to build single library (one file) for both Debug and Release modes assuming that my library has only C code in it?

As far as I remember, gtkmm, for instance, has it’s pre-built package, where C++ based libraries are shipped in both Debug and Release versions, but other – as a single file only.

E.g. they have gtkmm-vc90-d-2_4.lib and gtkmm-vc90-2_4.lib files for C++ based libraries and they have single libraries such as gtk-win32-2.0.lib for both Debug and Release configurations.

How can I achieve the same effect? What should I do to make the built library (pure C) configuration-independent?

  • 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-16T09:51:31+00:00Added an answer on May 16, 2026 at 9:51 am

    In theory you could build just one library if all the external headers for the library (ie the ones pulled in by the client) don’t use #ifdef _DEBUG (or any other macro that may be defined in a debug build but not a release build.

    Consider a case like this:

    // file: mylib.h
    struct A {
       int member1;
       int member2;
       #ifdef _DEBUG
         int extraDebugOption;
       #endif
    };
    

    In this case, if you were to link the library into a debug build of your own product then A will have a different size to the release build, which means you’re going to have some pretty horrendous memory corruption bugs to track down (been there…).

    EDIT:
    Forgot to mention, you should make your one configuration a Release configuration so that you don’t end up with any references to the debug CRT, and also so the library is optimised. As lsalamon points out, creating a pdb file and saving this along with your .lib file will be useful in the future for debugging.

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

Sidebar

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.