Hi,
i know this is a very old thread now, but I just found it again through a google search for another issue and I thought for completeness sake i'd update it with the solution. You never know it may be useful for other people who may have a similar issues in the future.
It turned out i was linking against incorrect libraries, i was linking against single threaded instead of multi threaded.
When i added the switch -mt in the linking stage the problem was solved.
hey .. better late than never.