July 9th, 2026
like1 reaction

I’ve decoded a #pragma detect_mismatch error and fixed the mismatch, but I still get the error

Some time ago, I showed how to decode a #pragma detect_mismatch error. A colleague ran into this error because they sync’d a change that modified the configuration of a common header file. “No problem, I’ll just rebuild after sync’ing.” But when they rebuilt their project, the error persisted. What went wrong?

The error message tells you the two pieces that are conflicting. In my colleague’s case, one of the pieces was an object file inside a library, and the other piece was an object file in their project. The catch was that the library was not part of their project. Therefore, rebuilding their project doesn’t rebuild the library.

After you fix a #pragma detect_mismatch mismatch, you need to recompile all of the object files that were dependent upon the header file that contained the mismatch. This rule isn’t special to #pragma detect_mismatch; it applies to any ODR error. If a structure changed definitions in a common header file, you need to recompile all of the object files that were dependent on the header file so they all agree on the new structure definition.

The fix was to rebuild the library that had been compiled against the old version of the header file. Safer would be to do a clean rebuild of the entire repo, to make sure no stale contents from the old header file still linger.

Topics

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments