In an attempt to add the include paths to Syntastic (3.6.0-106; Vim 7.3), to stop it from giving a fatal error at the first include it can't find, I tried creating a .syntastic_c_config
file. There's not a lot of information on how this is supposed to work, but there are references out there and I followed their example:
-I/path/to/include
-I/you/get/the/idea
-L/some/library
-lfoo
-lbar
-DHAVE_SOME_FLAG
-pedantic
-Wall
-std=c99
That is, one compiler argument per line.
This has had the effect of removing virtually all error checking, unless I force it with :SynasticCheck
-- at which point, it seems to work a little bit better, but not exactly how I'd expect. However, either way, if I :echo g:syntastic_c_config_file
(or any other option that I'm expecting to be set), Vim just gives me an undefined variable warning.
I'm clearly doing something fundamentally wrong, but I'm not really sure what!
It turns out that Syntastic will source the configuration file without explicitly setting the respective variable. Moreover, the contents of the configuration file are not passed into any syntastic_c_*
variables, but nonetheless passed into the call to gcc
. Syntastic is also clever enough to backtrace to look for the configuration file (e.g., it will go up levels until it finds it, so you can keep the .syntastic_c_config
in your project root).
As to why it was failing, the debug log was showing that my compiler was ignoring the library flags (-L/some/path
and -lfoo
) and that was blocking Syntastic from any further syntax checking. Removing those lines from my config file solved the problem.