It may be that the one that does work is compiled in release mode, and can find the relevant DLL in the system32 folder. Oh well, you'll have to re-enable it for now then.
I've done a little investigation (google), and it appears this may be a problem caused by your antivirus program. It's scanning the file immediately after the linker has created it, and just before the manifest is added to it - this causes the manifest to fail because it can't open the file for writing.
See if you can flag the program 'mt.exe' in your AV as a trusted program so that your AV doesn't double-check everything it does.
Quote: "1>c:\program files (x86)\microsoft directx sdk (august 2007)\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800"
Put this line immediately before the include of dinput.h to get rid of this useless warning:
#define DIRECTINPUT_VERSION 0x0800