views:

231

answers:

1

Hello:

I am using Visual Studio 2005's cl.exe compiler. I call it with a bunch of /I /D and some compilation/optimization flags (example: /Ehsc).

I have two compilation scripts, and both differ only in the /I flags (include directories are different). All other flags are the same. These scripts produce different object files (and not just a timestamp difference as noted below). The strange thing is that the /E output of both scripts is the same. That means that the include files are not causing the difference in object files, but then again, where is the difference coming from?

Can anyone elucidate on how I am seeing two different object files in my situation. If the include files are causing the difference, how come I see identical /E output?

PS. The object files are different not only in the timestamp, but in the code sections also. In fact the behavior of my final executable is different in both cases.

Edit: PSS: I even looked at the /includeFiles output of cl.exe and that output is identical. The object files, however, differ in more than just the timestamp (in fact, one is 1KB bigger than another!)

A: 

My guess is that you are including header files which #define some preprocessor constants that your code in turn depends on. You already mentioned that the behavior of your executable is different. If you have different code, then of course the object files might differ in size.

If that is the case, shouldn't the /E output be different? /E flag gives the output of the preprocessor.

Good point! So if you use /P (same as /E but to file), the generated files are exactly identical?

Magnus Skog
If that is the case, shouldn't the /E output be different? /E flag gives the output of the preprocessor.