3

I'm trying to set up Neomake to only use GCC as a checker, plus some options. Having looked at the documentation, I wrote this:

let g:neomake_c_enabled_makers=['gcc']

let g:neomake_gcc_args=[
      \ '-fsyntax-only',
      \ '-std=c99',
      \ '-Wall',
      \ '-Wextra',
      \ '-Wpedantic',
      \ '-fopenmp',
      \ '-I.'
      \ ]

However, when I open a .c file and try to have it checked, I get no results, even if there are obvious syntactic errors. Did I miss something obvious here?

  • do you have sth like autocmd! BufWritePost * Neomake somewhere in your config? or do you call Neomake automatically on other ways? – toogley Mar 4 '17 at 22:27
3

Well, I finally found the answer myself, and figured I'd leave this as documentation for others.

Problem: You want to use GCC as your only maker for C files. You set up Neomake and (Neo)vim the 'obvious' way, but it doesn't do any checking.

Solution: There's a couple of things involved here. Firstly, you need to ensure that (Neo)vim doesn't decide arbitrarily that .h files are C++ (which it does by default):

let g:c_syntax_for_h=1

Then, disable all makers for C except for GCC:

let g:neomake_c_enabled_makers=['gcc']

Then, sprinkle in appropriate arguments (the following are examples) to get the most out of your maker:

let g:neomake_gcc_args=[
    \ '-fsyntax-only',
    \ '-std=gnu11',
    \ '-Wall',
    \ '-Wextra',
    \ '-fopenmp',
    \ '-I.'
    \ ]

Now, you should have proper checking on both .h and .c files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.