How to set C++ compiler options for Syntastic

To learn how to install and use Syntastic, please see this post.

Syntastic should be able to detect the C++ compiler on your system and use it for syntax checking automatically. If you need to change it or set it explicitly, then add its command or full path to your .vimrc:

let g:syntastic_cpp_compiler = "g++"

You might want to enable some compiler options for Syntastic to apply on your code. For example, I like to add support for C++11 and also rigorously check for warnings, so I add this to my .vimrc:

let g:syntastic_cpp_compiler_options = "-std=c++11 -Wall -Wextra -Wpedantic"

Tried with: GCC 4.9.2, Vim 7.4 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s