Spacevim Neomake Error Error while trying to load a compilation database

Source: Internet
Author: User
Tags autoload

Go home and put on the archlinux, the whim of a spacevim write a question
Installation configuration It's not too much of a problem to say.
Finally, the following questions appear when writing a question

Error while trying to load a compilation database:Could not auto-detect compilation database for file "poj-1458.cpp"No compilation database found in /home/tanglizi/Code/acm/summerTraining/2018 or any parent directoryfixed-compilation-database: Error while opening fixed database: No such file or directoryjson-compilation-database: Error while opening JSON database: No such file or directoryRunning without flags.

Check Google, found that this is clang-check problem, Clang-check need a Compile_commands.json file (can be generated by CMake) to do engineering check
Then the problem is solved.

Method One

Uninstall the clang and replace the GCC
The absolute violence of the method, can say very not elegant

Method Two

Handwritten compile_commands.json files, or cmake a project
But to the ACM Brush Question party, this is really inconvenient

Method Three

Immediately abandoned the first two methods, so began to modify the Vim plugin
Or check Google, found that the problem is a name Neomake plug-in
So find the file about Clang-check and see how it calls Clang-check's

grep clang-check -R ~/.cache/vimfiles/repos/github.com# /home/tanglizi/.cache/vimfiles/repos/github.com/neomake/neomake/autoload/neomake/makers/ft/c.vim:    " ‘exe‘: ‘clang-check‘vim /home/tanglizi/.cache/vimfiles/repos/github.com/neomake/neomake/autoload/neomake/makers/ft/c.vim

You can see that line 32nd appears Clang-check

function! neomake#makers#ft#c#clangcheck() abort    return {        \ ‘exe‘: ‘clang-check‘,        \ ‘args‘: [‘%:p‘],        \ ‘errorformat‘:            \ ‘%-G%f:%s:,‘ .            \ ‘%f:%l:%c: %trror: %m,‘ .            \ ‘%f:%l:%c: %tarning: %m,‘ .            \ ‘%I%f:%l:%c: note: %m,‘ .            \ ‘%f:%l:%c: %m,‘.            \ ‘%f:%l: %trror: %m,‘.            \ ‘%f:%l: %tarning: %m,‘.            \ ‘%I%f:%l: note: %m,‘.            \ ‘%f:%l: %m‘,        \ }endfunction

So in the 33 line of args add '--', the same treatment Clang-tidy (75 lines), it's done.

        \ ‘args‘: [‘%:p‘, ‘--‘],

The idea is to add '--' after the original command, Clang will not find compilation database.

clang-check file.cpp --

Spacevim Neomake Error Error while trying to load a compilation database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.