在VS2008下编了一个静态库,发现release版比debug版大了2.5倍多(R:3.8M,D:1.45M),最后比较发现VS2008 Release默认优化选项:
全程序优化(Whole Program Opeimization)为Enable link-time code generation (/GL)
关掉正常,把VS2008的设置改为No就可以了。(其他VS版本均默认为No)
http://stackoverflow.com/questions/2052136/release-lib-is-huge-compared-to-debug