Sometime in the past little while either the clang on the systems I use (Fedora) were updated to use precompiled headers by default, or else my re-install of the clang complete git plugin from github did it (the previous install was a few years old) -- I'm not sure which since I have not been doing much C++ for a few months, and now I'm busy with it again.

Note that I don't use clang for normal compiles, I use GCC. I don't believe the latter is involved because of the timestamps on the .pch files.

Anyway, the precompiled .pch headers are left in /tmp. The problem is, regularly when checking source files I get mismatch errors in relation to the headers which are very obviously wrong in relation to the current version. The error is then followed by a message to the effect that "the current precompiled .pch is older than the header source" which persists no matter what.

I've tried:

  • Making minor edits to the header, resaving, re-running ClangUpdateQuickFix; doesn't matter, still uses old compiled version.

  • Closing and reopening the header file and making changes and doing the same thing, no change.

  • Deleting all the .pch files from /tmp. This makes the situation worse. Now UpdateQuickFix will do absolutely nothing for the files including the header. I can add complete garbage to them and it still shows no errors.

This might be an XY problem -- I'm fine with a way that will recompile the headers when necessary. It might be more of a clang related question, but looking through their manual it only talks about enabling them on the command line and how useful they are, not how to get rid of the "feature whether you like it or not".

The only solution I've found is to shut down and restart vim, which it a complete PITA.

1 Answer 1


Over the past week I've decided I was wrong about re-running ClangUpdateQuickFix on a buffer containing the header not working. Although I would never have written that if I had not tried several times, it was probably all during the same session -- meaning I could have overlooked something such as having pre-compiled the headers with a different user.

Anyway, re-clanging the header in vim seems to do the trick.

  • Since writing this answer I have noticed it still, absolutely definitely, does not always hold -- i.e., there was no mistake in my original question. I'll put it down to a very irritating bug.
    – goldilocks
    Mar 18, 2016 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.