I have a static library project with standard debug/release build options. I was intrigued to spot that while the debug .lib is a fairly large 22Mb, the release one is a whopping 100Mb. And this is not a massive code-base either, about 75 classes and none of them very giant.
My questions are whether this is normal, and whether I should care?
I would check to see if you're statically linking libraries in release mode and dynamically linking them in debug mode. You might be statically linking the C++ runtime for instance.
I had the same problem. The fix is very simple. Project Property/Configuration properties/General/Whole Program Optimization use No Whole Program Optimization instead of Use Link Time Code Generation. Size of my static library decreased from 5MB to 1.3MB
No, this is not normal. It should be the other way around. Yes, you should care.
I'd start by looking at the sizes again, to make sure I didn't transpose the release and debug sizes somehow.
Then look at the libraries you're linking in for release and debug. Did you accidentially link a debug library to ship, and ship library to debug?
Take a close look at your settings for release and debug. Something very fishy is going on.
Is it possible that a massive amount of this code is inline, and the debug version isn't "inlining"?
Ideally release lib should be smaller than debug one.
I guess you may be statically linking other libs such as MFC ,ATL etc...
check you release and debug build setting.
use #pragma once
to avoid multiple time file inclusion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With