I'm trying go get VIM to compile c or c++ code with Clang instead of gcc (as I prefer the debug-output from CLang). Unfortunately I am unable to get :make to use ClLang for compiling. So time to ask if someone can point me in the right direction as I'm still getting to grips with VIM:
Relevant info: 0) This is on FreeBSD stable with clang-develop from ports. 1) I've checked that compiling with clang++ from the CMD-line works as it should. 2) Hence clang and clang++ are indeed in $PATH. 3) I've used the vimrc file as provided by the llvm project, see https://llvm.org/svn/llvm-project/ll...tils/vim/vimrc *) the above should have worked according to the discussion in the llvm mailing-list here: http://markmail.org/message/mq73uxpc...+state:results which it doesn't as it still uses gcc to compile. 4) I have subsequently set which compiler runs by typing :set makeprg=clang++ for c++ code (I've also tried :set makeprg=clang instead) It clearly is using clang after this. Unfortunately it I get a strange error-message that doesn't happen when compiling the same hello world test-code directly from the command line. The output I get is: --- 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) --- Which is the point at which I'm stuck (and google doesn't help me). I've also tried with a piece of plain c-code instead of cpp, but this leads to the same error-message. Hopefully this error-message triggers thoughts on what I'm doing wrong here. For clarity both the c and cpp-code compile fine with clang directly from the commandline. So the problem must be in the way how I call clang from vim (using :set makeprg=clang++ or :set makeprg=clang). Hopefully somebody knows what the correct way to do this? -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
