7

I just started using syntastic for vim, and I'm loving it so far, but I have one tiny issue. If the file extension is not cpp, running ":SyntasticCheck" does absolutely nothing. This is a problem, as I would like to run syntastic on header files as well, with extensions such as ".h" or ".hpp". Can anyone help me out? I'm using 'gcc' as my cpp syntastic-checker, if that helps.

Dan Cauley
  • 198
  • 1
  • 8

2 Answers2

5

Add the following to your vimrc

let g:syntastic_cpp_check_header = 1

this setting was found by reading the comment at the top of <syntastic>/syntax_checker/cpp/gcc.vim

FDinoff
  • 30,689
  • 5
  • 75
  • 96
1

Basically, you need to add the path contains your header files such as let g:syntastic_c_include_dirs = ['../../include','../include','include'] and turn on the variable to check your header files let g:syntastic_c_check_header = 1

Moreover, you can also pass flags and options to compiler by let b:syntastic_c_cflags = '-I/usr/include/libsoup-2.4' and let g:syntastic_c_compiler_options = '-ansi -DMACRO_NAME'.

It helps in many conditions i.e. when you have many macro definitions.

You can find more useful options in its official Github. C:gcc checker options