Christian Gibbons Christian Gibbons - 2 months ago 25
C++ Question

Syntastic complaining about missing file

I am working on a c++ project utilizing Qt. I have enabled syntastic to check headers through my vimrc, and its checkers (gcc, clang_check, and clang_tidy) all complain about the same thing in my project: they're unable to find a particular header file.

The header file in question is 'QtCore/qconfig-64.h'. And they are correct that this file does not exist. The problem is that this file should not be loaded into the project as it is a 32-bit project. 'QtCore/qconfig.h' has a preprocessor direction informing the project what to include:

#if __WORDSIZE == 32
#include "QtCore/qconfig-32.h"
#elif __WORDSIZE == 64
#include "QtCore/qconfig-64.h"
#else
#error "unexpected value for __WORDSIZE macro"
#endif


Is there any proper solution to get syntastic to recognize the preprocessor directive choosing which header file to include? If not, what other work arounds might be available to silence these errors while minimizing loss of utility?

Answer Source

See :h 'syntastic_quiet_messages', try this for your case

let g:syntastic_c_gcc_quiet_messages = {
        \ "regex": ['\mQtCore/qconfig-64\.h']
        \}

Note: QtCore/qconfig-64\.h can be expanded to full error message to try to avoid missing other messages with same string