如何在synvistic vim插件中添加c ++ 11支持? [英] how to add c++11 support to syntastic vim plugin?
问题描述
我在c ++ 11项目中使用syntastic.当我在vim中进行编辑并保存(:w)时,syntastic插件在每个初始化器列表{}以及每个循环上都给我错误,这些错误显然是c ++ 11所缺少的功能.
I am using syntastic in my c++11 project. When I am editing in vim, and save (:w) the syntastic plugin gives me errors on every initializer list {} and for each loops which are clearly c++11 features that it's missing.
我使用病原体安装了合成物.
I installed syntastic using pathogen.
这是我在初始化列表和每个循环中遇到的错误的两个示例(两个c ++ 11都可以正常编译):
Here are two examples of the error I am getting on initializer lists and for each loops (both c++11 that compile fine):
推荐答案
Syntastic的C ++ linter(语法检查器)有很多可以在.vimrc上设置的选项(不幸的是,我希望它是特定于项目的,例如.clang_complete解决方案).
Turns out the C++ linter (syntax checker) of syntastic has many options that can be set on your .vimrc (unfortunate, I wish it was project specific, like the .clang_complete solution).
要启用c ++ 11标准并在clang中使用libc ++库(这是我的项目正在使用的库),我在〜/.vimrc中添加了以下几行
To enable c++11 standards and use the libc++ library with clang (which is what my project is using) I added the following lines to my ~/.vimrc
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
它现在可以很好地工作了.
it now works beautifully.
这篇关于如何在synvistic vim插件中添加c ++ 11支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!