Mac OS X更新EI Capitan之后vim的ycm插件的语法检测出现异常的解决办法
在更新了系统之后发现ycm插件的的语法检测出现非常奇怪的错误,连一个简单的hello world都会报错,于是我把homebrew里边的软件全部更新了一边之后还是不能用,总算是明白了为啥稳定的服务器是不更新东西的了- -
当时的hello world的错是ostream 和 const char *的二元操作符未定义,原因很好推测,那就是找到了iosream却没找到ostream重定义的操作符<<,于是就找啊找,最后发现是在.ycm_extra_conf.py文件中需要指定头文件的位置,至于之前我没指定为什么还好好的,我也不知道,哈哈, 所以在.ycm_extra_conf.py的 flag 列表下面添上找到的头文件目录即可,至于怎么找系统的头文件目录已经在注释中写了哟- -
#Using `echo | clang -std=c++11 -stdlib=libc++ -v -E -x c++ -` to generate the following infos '-isystem', #Mark as system header '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1i', '-isystem', '/usr/local/include', '-isystem', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include', '-isystem', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include', '-isystem', '/usr/include', '-isystem', '/System/Library/Frameworks (framework directory)', '-isystem', '/Library/Frameworks (framework directory)',
之后就搞定了
PS:homebrew更新的命令是
sudo brew update #首先更新homebrew以确保之后的更新是有效的
brew upgrade #将所有homebrew管理的软件全部更新
PS: vim插件的更新由于我是用pathogen管理的, 也没找到自动更新的方法,于是一怒之下写了个自动更新的脚本,对于直接用git pull命令不能更新的插件,可以根据插件名字重新写个特定的更新函数来处理,不过貌似很多vim插件更新就只要git pull一下就ok了- -,ycm的由于对更新用的不(懒)是(癌)很(发)熟(作)悉。。。先搁着吧
#!/usr/bin/python #coding:utf8 import os import os.path HOME = os.environ['HOME'] def update(filename, fullpath, repositoryPath) : if os.path.isdir(fullpath) and os.access(repositoryPath, os.F_OK) and os.path.isdir(repositoryPath) : os.chdir(fullpath) print 'update ' + filename + '..' if os.system('git pull') == 0: print 'success' else : print 'failed' print def updateVimPlugins(pluginPath = HOME + '/.vim/bundle/') : print if not os.access(pluginPath, os.F_OK) or not os.path.isdir(pluginPath) : return fileList = os.listdir(pluginPath) for filename in fileList : fullpath = pluginPath + filename repositoryPath = fullpath + '/.git/' #在这里添加特定插件的更新代码 update(filename, fullpath, repositoryPath) if __name__ == '__main__' : updateVimPlugins()
浙公网安备 33010602011771号