Click here to Skip to main content
15,885,056 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was testing out some changes to stdafx.cpp so I set the /force option in the customize link options. This worked fine but I noticed the .exe when compiled was 2MB smaller than when I compile it without these changes any ideas as to why? The code executes fine and shows no difference other than the one change I was trying to make. I am using MSDEV vs6 c++..
I am using the /force option due to the following Microsoft Article.. http://support.microsoft.com/kb/245434/pt-b[^]
Posted
Updated 9-Mar-12 5:34am
v2
Comments
Mohibur Rashid 8-Mar-12 21:00pm    
In both case you compiled in debug mode, try to compile in release mode and see if there is any different. one heads up is release mode is always smaller than debug mode
Lakamraju Raghuram 8-Mar-12 22:25pm    
release mode is not always smaller than debug...

Why did your change require you to set the /force option?

If the linker is not complaining why set it? This is really just a workaround for problems that ( may) exist with the linking of your program.

Have you set the compiler warning level to 4? If you are getting warnings can you explain or remove them.

Have you produced a linker output file using /MAP option? http://msdn.microsoft.com/en-us/library/k7xkk3e2(v=vs.80).aspx[^]

If you produce the map file for both conditions (with and without changes) and compare them you will be able to determine what has been linked differently.

Other than that there is no simple answer to your question.

This is because what the /force option does is completely determined by your code and whatever symbols are unresolved or multiply defined.



16-03-2012 You have added this information to your question.

Member 3782238 wrote:
I am using the /force option due to the following Microsoft Article.. http://support.microsoft.com/kb/245434/pt-b[
title="New Window" href="http://support.microsoft.com/kb/245434/pt-b" target="_blank">^
]



The answer as to why the exe is different in size has nothing to do with /FORCE. It is because this solution requires static linking of the MFC library. You were probably dynamically linking before. With static linking the MFC library is added to your executable. Static linking vs dynamic linking will always produce different size executables.

My earlier answer is still valid.
 
Share this answer
 
v6
so you are saying like when you used /fore option exe size is reduced by 2mb?

are you using any other .libs in the program ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900