[LLVMdev] Vim auto completion

moesasji miyamoto31b at gmail.com
Tue Mar 1 14:47:07 PST 2011


Dan Gohman <gohman <at> apple.com> writes:

> 
> The clang patches are now applied, so vim auto completion now works mostly
> out-of-the-box -- just build clang, set up your PATH for clang and clang++,
> and copy utils/vim/vimrc to ~/.vimrc (or symlink, or do your own thing).
> 
> To configure the clang command-line, look for the g: configuration
> variables in the vimrc file.
> 

I've been trying to get VIM to compile c++ code using clang++ based on the above
comments as I prefer its debug output over gcc. Unfortunately so far without
much success and Google does not really help me in finding a solution. So I hope
that someone can point me in the correct direction as I would like to see how
the vim autocompletion works. 

I'm currently using the 2.9 branch of clang + llvm on FreeBSD stable and can
compile a hello world program from the commandline directly so both clang and
clang++ are in the path. However when running vim with the above vimrc file I
however fail to compile the same bit of code from within VIM (using :make
<program name>). 

In this I set make in VIM to cLang by typing :set makeprg=clang in VIM. Yet the
output I get makes no sense to me although it clearly is using clang to do the
compile. Hopefully somebody can point out what I do wrong here? 

fyi) below is the compiler or linker output I get when running :make hello
although it probably is not relevant. The same code compiles without problems
when compiling from the CMD-line 
---
hello:(.data+0x8): multiple definition of `__dso_handle'
/usr/lib/crtbegin.o:(.data+0x0): first defined here
hello: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/crti.o:/usr/src/lib/csu/amd64/crti.S:(.init+0x0): first defined here
hello:(.data+0x0): multiple definition of `__progname'
/usr/lib/crt1.o:(.data+0x0): first defined here
hello: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/crt1.o:crt1.c:(.text+0x0): first defined here
hello: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/crti.o:/usr/src/lib/csu/amd64/crti.S:(.fini+0x0): first defined here
/usr/local/bin/ld: error in hello(.eh_frame); no .eh_frame_hdr table will be
created.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
---




More information about the llvm-dev mailing list