简体   繁体   English

Vim Syntastic显示警告并设置警告级别

[英]Vim Syntastic show warnings and set warning level

I use Vim with syntastic to code in C++ and I see all errors but I don't get any warnings. 我将Vim与syntastic一起使用C ++进行编码,我看到了所有错误,但没有收到任何警告。 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. 有些错误在不同的c ++标准中有所不同,因此应该至少可以更改c ++的版本以进行错误检查。

  • 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++? 使用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. 如果我得到要为c ++运行的特定命令,那么下次我会迷路的。

I can't find how to do this from the manual at :h syntastic . 我在:h syntastic的手册中找不到如何执行此操作。 I have only looked at the sections that I thought were relevant however. 我只看了我认为相关的部分。

for every project, in .vimrc in the project folder i will put something like 对于每个项目,在项目文件夹中的.vimrc中,我将输入

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

you can select -w , -Wno- or any warning level you want 您可以选择-w ,-Wno-或所需的任何警告级别

use g:syntastic_c_compiler_options for pure C code 对纯C代码使用g:syntastic_c_compiler_options

ofcourse you put this in the global .vimrc. 当然,您可以将其放在全局.vimrc中。 here we use vim to edit code in several programming languages, so we use different .vimrc per project 这里我们使用vim来编辑几种编程语言的代码,因此我们在每个项目中使用不同的.vimrc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM