0

I use Vim with syntastic to code in C++ and I see all errors but I don't get any warnings. It would be nice if I didn't have to use the compiler in the terminal just to get all compiler-messages. Some errors differ in different c++ standards so it should be possible to at least change the version of c++ to error-check for.

  • How do I do I show warnings?
  • How do I set the warning levels and settings as I do when I compile a program using g++?
  • How do I set this up if I start using another language? If I get a specific command to run for c++, then I would be lost the next time.

I can't find how to do this from the manual at :h syntastic. I have only looked at the sections that I thought were relevant however.

dekuShrub
  • 466
  • 4
  • 20

1 Answers1

2

for every project, in .vimrc in the project folder i will put something like

let g:syntastic_cpp_compiler_options="-m32 -I ./inc -I ./inc/libs"

you can select -w, -Wno- or any warning level you want

use g:syntastic_c_compiler_options for pure C code

ofcourse you put this in the global .vimrc. here we use vim to edit code in several programming languages, so we use different .vimrc per project

  • So... can I just type `let g:syntastic_cpp_compiler_options="-Wall"` to enable warnings and it will not overwrite any of the default settings (if there are any)? – dekuShrub Apr 19 '18 at 08:51
  • yep, i will keep 2 or 3 settings in the .vimrc, commenting out the unnecessary. use " to comment a row – user3723030 Apr 19 '18 at 09:34
  • Ok, nice! it seems to work for me to simply set all my usual flags in that string. Are the options you have written in the answer `-m32 -I ./inc -I ./inc/libs` relevant for me? I don't recognize any of them. – dekuShrub Apr 19 '18 at 10:43
  • yea i just pasted my settings, you can put any valid gcc/g++ flags there. the ones you see will add include directories, and force 32bit output – user3723030 Apr 19 '18 at 12:42