I had a similar problem in VC++ 2005 where for some reason on occasions the Linker tries to link mixtures of run time and debug libraries.
I took Microsoft's advice and excluded the following libraries on a DEBUG build as follows:
Open your Solution/Project's Configuration properties
Go to the Linker settings
In the Input section under Ignore specific libraries add the following:
atls.lib, libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib
This cured my problem.
No matter how good your code is, someone will improve on it