Ero di fronte allo stesso problema e Insisto per elaborare C++ 98 e C++ 11 separatamente. qui di seguito è la mia soluzione:
creare il file di nome gcc.vim sotto fascio/syntastic/syntax_checkers/cpp11/ e copiarli ad esso:
"============================================================================
"File: cpp11.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_cpp11_gcc_checker')
finish
endif
let g:loaded_syntastic_cpp11_gcc_checker = 1
if !exists('g:syntastic_cpp11_compiler')
let g:syntastic_cpp11_compiler = executable('g++') ? 'g++' : 'clang++'
endif
if !exists('g:syntastic_cpp11_compiler_options')
let g:syntastic_cpp11_compiler_options = '-std=c++11'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cpp11_gcc_IsAvailable() dict
return executable(expand(g:syntastic_cpp11_compiler))
endfunction
function! SyntaxCheckers_cpp11_gcc_GetLocList() dict
return syntastic#c#GetLocList('cpp11', 'gcc', {
\ 'errorformat':
\ '%-G%f:%s:,' .
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,'.
\ '%f:%l: %trror: %m,'.
\ '%f:%l: %tarning: %m,'.
\ '%f:%l: %m',
\ 'main_flags': '-x c++ -fsyntax-only',
\ 'header_flags': '-x c++',
\ 'header_names': '\m\.\(h\|hpp\|hh\)$' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp11',
\ 'name': 'gcc' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:
che renderà pedina gcc disponibile (vuole l'altro checker? puoi fare le cose simili che ho fatto per te) per i file con & filetype == 'cpp11' in vim. come rendere i tuoi file automaticamente riconosciuti come cpp11 filetype in vim? basta creare file di nome ext_detect.vim sotto ~/.vim/ftdetect/ con il seguente contenuto:
au bufnewfile,bufread *.cpp11 set ft=cpp11
au bufnewfile,bufread *.cppx set ft=cpp11
in questo modo, è possibile elaborare i file cpp * come C++ 98 standard * .cpp11 o * .cppx come C++ 11 standard separatamente, non solo il controllo della sintassi, ma anche l'evidenziazione della sintassi (se hai bisogno del supporto per l'evidenziazione della sintassi cpp11, this vim plugin sarà utile, anche se non perfetto).
Qual è l'output del comando ': echo b: clang_user_options' da un buffer che appartiene al progetto? Se la tua ipotesi è corretta, non ci sarà la sottostringa '-std = C++'. – xaizek
L'output di ': echo b: clang_user_options' è' -I/usr/include -std = C++ 11 -stdlib = libC++ '. Quindi non capisco perché sto ricevendo gli errori relativi agli elenchi di inizializzatori e per ogni loop. Aggiungerò un errore di esempio al post principale. – Carneiro
Risulta che questo è ** non ** clang_complete, questo è syntastic. Aggiornerò il post e la risposta – Carneiro