In most cases, the compiler detects this and reports the error when building the application. But depending on how your code is written, sometimes the problem is detected only at run-time.
Personally I'm somewhat unimpressed by this. Although I admit to not having done the maths so I haven't actually
proved that the compiler logically could detect all cases.
I haven't done a proper analysis, but my feeling is that whenever I've seen this error in any code I've written it's gone away on a complete system recompile and relink, including all DLLs (possibly to be replaced by the compile time error if my code
is actually wrong, which even my code can be, temporarily, on rare occasions

).
So, there's just a suspicion that this error occuring on a production system, ie a punter's machine rather than the original programmer's machine, might be a "DLL hell" symptom, ie an incompatible set of versions of DLLs trying to work together. In which case we're back to the usual - the question to ask is "immediately before this started going wrong, exactly what was it that I installed?" and try to restore the system to what it was before that.