Possible Duplicate:
Issue using Visual Studio 2010 compiled C++ DLL in Windows 2000
Similar to these questions:
Can I use Visual Studio 2010's C++ compiler with Visual Studio 2008's C++ Runtime Library?
Can VS2010 create native executable file working under Windows 2000?
I have C++ code that I'm compiling from the command line (using CL.EXE) using VS2010 (CL version 16.00.30319.0) on a WinXP machine, but I want the resulting native (x86) executable program to run on Win2000, WinXP, etc.
Older versions of CL (VC98, version 12.00.8186) do the job just fine, but the VS2010 version produces an executable that, when run on Win2000, results in a pop-up error:
foo.exe is not a valid Win32 application
The solution must be in the form of CL compiler or linker options, not VisualStudio settings or properties. I don't need any of the newer C++ language features, since the code is a few years old and written to be portable to other OSs, and I want only native code (x86, not .NET or CLI) executables.
(See http://david.tribble.com/src/crlf.cpp and http://david.tribble.com/src/detab.cpp for examples.)
I suppose I could keep using the older compiler (VS 9.0) on my new development environment (WinXP, and eventually Windows 7), but that seems like a less than ideal solution. Surely MS still provides a way to create native executables that are backward-compatible to older but still-extant Windows OSs?