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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:10:24+00:00 2026-05-28T16:10:24+00:00

When compiling a ‘static library’ project in MSVC++, I often get .lib files that

  • 0

When compiling a ‘static library’ project in MSVC++, I often get .lib files that are several MB in size. If I use conditional macros and include directives to “condense” all my .cpp files in one .cpp file at compile time, the .lib file size decreases considerably.

Are there any disadvantages with this practice?

  • 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-28T16:10:25+00:00Added an answer on May 28, 2026 at 4:10 pm

    The main problem of Unity Builds as they are called is that they break the way C++ works.

    In C++, a source file, with its includes preprocessed, is called a Translation Unit. Some symbols are “private” to this translation unit:

    • symbols declared static at namespace level
    • anything declared in anonymous namespace

    If you merge several C++ files, then the compiler will share those private symbols among all the files that are merged together since from its point of view this has become a single Translation Unit.

    You will get an error if two local classes suddenly have the same name, and idem for constants. Annoying as hell, but at least you are notified.

    For functions however, it may break silently because of overload. When before the compiler would pick static void launch(short u); for your call to launch(1), then suddenly it will shift to static void launch(int i, Target t = "Irak");. Oups ?

    Unity Builds are dangerous. What you are looking for is called WPO (Whole Program Optimization) or LTO (Link Time Optimization), look into the innards of your compiler manual to know how to activate it.

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

Sidebar

Related Questions

When compiling our project, we create several archives (static libraries), say liby.a and libz.a
When compiling C++ with the -fdump-tree-gimple option (GCC 4.6.1), I get code that has
Compiling my project against STLPort I get some weird build errors. Weird, because the
Compiling my project on new xcode4 using llvm 2.0 compiler I get a strange
After compiling of c++ file (with global static object) I get in nm output
When compiling an OCaml project which links against libraries requiring the C++ standard library
Compiling a file that uses OpenGL with Visual C++, when I try to include
When compiling my C++ .Net application I get 104 warnings of the type: Warning
After compiling a simple C++ project using Visual Studio 2008 on vista, everything runs
When compiling an ASP.NET 2.0 App names MySite for deployment I get a series

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.