0

My .vimrc file looks like that:

set exrc
set secure
set number
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set background=dark
set vb t_vb=
set colorcolumn=110
highlight Pmenu ctermfg=2 ctermbg=0 guifg=#ffffff guibg=#0000ff
highlight ColorColumn ctermbg=darkgray
autocmd CompleteDone * pclose
compiler g++

But, when I am opening some C++ files, I see such a message:

E666: compiler not supported: g++

What's the problem?

4
  • Use :compiler to get a list of available compilers. Commented May 24, 2015 at 19:00
  • Okay, there is gcc compiler, but there is no g++ compiler. How can I add it? Commented May 24, 2015 at 19:02
  • @Andrew apt-get install g++? Commented May 24, 2015 at 19:18
  • No, I have installed g++ :) Commented May 24, 2015 at 19:19

1 Answer 1

3

The :compiler command selects a compiler plugin; there's one named gcc, but none named g++. That's the E666 you get.

You can obtain a list of all installed compiler plugins by typing :compiler followed by <C-D> (lists all) or <Tab> (completion).


Note that compilation of C/C++ source code is usually done via make (or equivalent build tool); a simple g++ invocation is just for turning a single C/C++ source code file to an object file; you're missing a lot of infrastructure there.

There's the SingleCompile plugin (which supports g++, among many others), though.


Writing a new compiler plugin isn't much work; you essentially only need to define makeprg and errorformat, see :help write-compiler-plugin.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.