how to add c++11 support to syntastic vim plugin?

前端 未结 5 765
抹茶落季
抹茶落季 2020-12-23 02:18

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

5条回答
  •  盖世英雄少女心
    2020-12-23 02:37

    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).

    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.

提交回复
热议问题