Improve C++ header location detection (bug 13966)