For a legacy project, I have a solution in Visual Studio 2010 that compiles using the Visual Studio 6 compiler using the Daffodil extension for Visual Studio 2010.
I am trying to get the compiler (and linker) input equal (as much as possible) to that of the input I would have had when using Visual Studio 6. So I am comparing the build log file of the VS2010 project to the build log file of the same project in VS6.
I noticed when building in VS2010, the compiler switches passed on the generated command line are different. Some of these differences I can fix in the project file settings in VS2010 but others I can't seem to find: for example the /FD
and /TP
switches are present when building with VS6 but absent when building with VS2010 and I cannot seem to find these switches anywhere in the project settings in the IDE either. and yet other differences I cannot seem to resolve because I cannot find what the default switches are for VS6 (yes I tried Google): for example the /EHsc
switch is present when building with VS2010 but absent when building with VS6, is this a difference or is this the default for the VS6 compiler?
So my question is:
PS:
* the compiler switches that I noticed present in VS6 but absent in VS2010: /FD
* the compiler switches that I noticed absent in VS6 but present in VS2010: /EHsc
/Gd
/TP
/WX-
/O2
/Oy-
I know most of this is probably fixable in the project settings but I decided to add the full list for this project anyway, hoping that someone could shed some more light on the specifically troublesome compiler switches to align.
UPDATE: OK, here's what I found and solved:
/WX-
switch (treat warnings as errors) is probably harmless assuming that it's a negate of a switch that was absent originally anyway, doesn't seem to have any effect, I suspect it's injected by Daffodil /O2
switch (favor fast code) implies several other optimization switches and was a serious mistake, removed by clearing the optimization setting in the project setting /Oy-
switch (omit frame pointer) is also probably harmless assuming that it's a negate of a switch that was absent originally anyway, doesn't seem to have any effect, I suspect it's injected by Daffodil /D _VC80_UPGRADE=0x0600
switch that was injected by the IDE but it's meaningless to the VS6 compiler so it's harmless /EHsc
switch (synchronous exception handling) is apparently the same as a /GX
switch that was already present originally so this appears to be OK /Gd
switch (default cdecl
calling convention) is apparently the default for the VS6 compiler so it's presence is harmless, I suspect it's injected by either Daffodil or the IDE /TP
switch (treat all files as C++ source files) I cannot find how to configure this anywhere but with mixed sources it is potentially dangerous, I don't know how to get rid of this switch, it's injected by either Daffodil or the IDE And then the linker switches... I managed to align most of them except:
/stack
switch (reserved stack size) is hexadecimal in VS6 but decimal and enclosed in quotes in VS2010, so I had to specify it on the command line but... /machine:I386
and /mapinfo:lines
switches are not known in VS2010 so I had to specify them on the command line. they are appended to the very end of the linker command line after the file list, which is easy to overlook and I'm not 100% sure the linker actually picks up additional switches after the file list..The /TP
switch is added by the IDE.
The /stack
switch accepts values in decimal or C-language notation. I did a quick test and the VC6 linker appears to correctly interpret the values in quotes as well, so I don't think you need to specify those separately.
The /machine
values can be specified on the Linker\Advanced property page, although it looks like the list of selectable values does not quite match the VC6 documentation. That may be a Daffodil bug, or it may be that the documentation is inaccurate.
The /mapinfo
switch must be added to 'Additional Options' as you mentioned.
If you have not disabled logging, you can check your linker command log file (link.command.1.log
) to see the exact switches passed on the command line. I tested this with the /mapinfo
switch, and it is appended to the end of the command line as expected.