Why is it that, when I create a programme for windows, using the Windows API and C++, in MSVC++ 2010 on Windows 7, without using new "stuffs" or classes(interfaces) like COM, my programmes do not work on XP. But when I do it vice-versa, it works on Win 7. Even if I add COM codes while programming on XP, the COM codes don't work, but it works on Win 7.
To summarize, my question is: Why is it that, when I code(build my programme) on Win 7(both Debug and Release) and,run it on XP, it asks for some file?
Well, I was thinking that VC++ 2010 links its executables to the 2010 version of the C++ runtime, but installs both the 2010 version and the 2008 version, while VC++ 2008 only installs the 2008 version, but if you have both 2010 and 2008 installed on XP, then I'm not sure.
I'm reading the MS page for the 2010 runtime and it says that the earliest version of XP supported is SP3. Perhaps the IDE didn't install it because it's not compatible?
You can always just link the runtime statically into the executable. Under Project Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library, select an appropriate option without the "DLL" bit.
This will make the executable a bit larger (100 KiB or so), but the program should work everywhere.
Why is it that, when I code(build my programme) on Win 7(both Debug and Release) and,run it on XP, it asks for some file?
Which file does it ask for?
When you build a program, it goes through two stages, (a) compile and (b) link. For example, if your program does any kind of input or output (and just about all programs do!), these capabilities are supplied by library functions. The purpose of stage (b) linking is to add these library functions to your program.
Possibly your Win-7 set-up is configured to build using dynamic linking to the run-time library. You could copy the run-time library along with your program, when transferring to XP. Or change the build configuration to use static linking instead. This makes the resulting executable file larger, as it includes its own copy of the required library functions.
One possible complication to this is that the Win7 executable might not be backwards compatible with XP (I'm not sure about that). In that case a solution might be to copy the source code to the XP system, and build the program there.