1

I often use HPP files when separating a template header from its implementation. In this scheme an

#include"impl.hpp"

is inserted in the .h (the header) file after all relevant definitions. As such, there is no real need to include said header in the .hpp file as the .hpp itself is what is being included.

When using Syntastic, the plugin uses the headers to determine which symbols exist. Thus, the implementation which depends on symbols in the header comes up with errors on the check. The easy way to fix this is to include the header itself in the .h file. When working in groups who do not have this redundant inclusion, I do not want to add it.


Is there a way to either have Syntastic use symbols from another file (the name is always the same base name .h) when checking the file? Or maybe a secret g++ option I missed (note: a file with symbols, not an include directory)?

Alternatively, is there a safe way to add a line to the top of a file when opening an hpp file on a temporary base, such that it will not be saved to the file but still used by Syntastic? The fact it is not saved to the actual file needs to survive a crash for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.