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.
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
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 ie when you have many macro definitions.
You can find more useful options in its official Github. C:gcc checker options
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.