The problem is caused as a result of several files clashes.
It is caused as a result of several files #including winnt.h along with the existing ones. Someone on stack overflow mentioned casually that he once had the problem when he #include
stringapiset.h
to his project. I had the header file in an header file that contained functions for converting to utf8 to utf16 and vice versa. The functions use MultiButeToWideChar fuction and its sister WideCharToMultibyte function. So, I decided to unplug the function fom my app. I commented out
WidCharToMultibyte
and its sister from the function to see what will happen. Shockingly, that sovled the problem.
So, if you have such a problem in the future consider files that #include winnt.h to the build system and find a way to resolve the clash.