Visual C++ 9.0 (2008) Static Lib + Boost Library = Large .lib File

末鹿安然 提交于 2019-12-11 06:48:49

问题


I have a Visual Studio 2008 C++ project that outputs a static library and uses some functionality of the Boost Library. When I build the project in Debug configuration, the .lib file is 7.84 MB. When I build the project in Release configuration, the .lib file is 23.5 MB. !!!!

The only Boost headers I include are:

  • boost/function.hpp
  • boost/exception/all.hpp

Since this is a static library, I don't have any Boost library files specified to include, but somehow it's a ginormous output. When I use that static library in a test executable, the resulting .exe file is only 746 KB in Debug and 231 KB in Release.

The problem is that I have to create a "release" of the library to check into a different repository to be used by other projects. And I would prefer not to have to add 30 MB of files each time I update it. And if nothing else it really confuses me as to why the Release build is 3 times the size of the Debug.

Anyone have suggestions as to what I'm doing wrong?

Thanks, Matt


回答1:


Project + Properties, C/C++, Optimization, Whole Program Optimization = No. That at least ought to keep your Release build size from blowing up. I can't repro the debug library size, just the headers gives me a 111KB .lib.



来源:https://stackoverflow.com/questions/2472568/visual-c-9-0-2008-static-lib-boost-library-large-lib-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!