3

clang++ version: 2.9 vim version: 7.3

I write my .clang_comple

--std=c++0x

with follow source code test.cc:

int main () {
    return 0;
}

And the clang_complete shows

test.cc|| unknown argument: '--std=c++0x'

in the quickfix list.

I try to add the option with

set g:clang_user_options="--std=c++0x"

the problem is still there.

Tried to trace some code of clang_complete, but still can not solve that problem. All other options can be processed correctly, but not --std=c++0x Do I miss anything? or made something wrong?

Peeter Joot
  • 7,848
  • 7
  • 48
  • 82
yoco
  • 1,404
  • 1
  • 14
  • 19
  • Despite adding `c++0x` tag it is turning as `c++11`. Huh ... – Mahesh Sep 09 '11 at 06:57
  • 3
    @Mahesh: c++11 is the standard accepted from the c++0x draft (http://herbsutter.com/2011/08/12/we-have-an-international-standard-c0x-is-unanimously-approved/) – sehe Sep 09 '11 at 07:18

2 Answers2

5

It isn't --std=c++0x but -std=c++0x according to the docs. Try it but I have never used clang though.

From docs :

To use with clang you can:

  • clang++ -stdlib=libc++ test.cpp
  • clang++ -std=c++0x -stdlib=libc++ test.cpp
ildjarn
  • 62,044
  • 9
  • 127
  • 211
Mahesh
  • 34,573
  • 20
  • 89
  • 115
3

In .vimrc, I usually use the following config:

let g:clang_user_options='-std=c++0x -x c++' 
map <F2>  :call g:ClangUpdateQuickFix()<CR>

Thus, I can press to compile the *.cpp files and

then use quickfix window to debug errors.

smartegg
  • 113
  • 8