syntastic C 搜索文件

来源:互联网 发布:laravel 获得sql语句 编辑:程序博客网 时间:2024/06/11 21:24

解决xxx.h not found 头文件找不到, 然后满屏幕标红的问题

情况一: syntastic + YCM导致

由于youcompleteme会禁用掉syntastic, 因此关闭YCM对C/C++的语法检查即可。

查看syntastic是否正常工作

:SyntasticInfo

Syntastic version: 3.7.0-237 (Vim 704, Linux, GUI)Info for filetype: cGlobal mode: activeFiletype c is activeThe current file will be checked automaticallyAvailable checkers: gcc makeCurrently enabled checker: gccPress ENTER or type command to continue

如果Currently enabled checker显示disabled by youcompleteme就在.vimrc中加入下行
let g:ycm_show_diagnostics_ui = 0 "0表示禁用ycm自带的syntastic插件

情况二:头文件不在include里

通常syntastic会自动检查include,../include
.vimrc中加入:

let g:syntastic_c_config_file = '.syntastic_c_config'let g:syntastic_cpp_config_file = '.syntastic_c_config'

那么需要在项目根目录下写个配置文件.syntastic_c_config
每个文件夹占一行

-I yourlib/-I yourlib/subdir
原创粉丝点击