Search code examples
cvim-pluginyoucompleteme

YouCompleteMe(YCM) doesnt suggest any formats (C11)


I'm trying to setup YCM to utilize autocompletion in C. I followed up the instruction described in the manaul.(:help YouCompleteMe) However it doen't show any autocompletion list for me. Part of flags in my ycm_extra_conf.py and debug info are like below. (ps, I also post my current status when I open C file and type pri (it should suggests printf or etc...)

Thanks :)

MY CURRENT STATUS

YCM DEBUG INFO

  '-std=c11',
  '-x',
  'c'
  '-isystem',
  '../BoostParts',
  '-isystem',
  '/System/Library/Frameworks/Python.framework/Headers',
  '-isystem',
  '../llvm/include',
  '-isystem',
  '../llvm/tools/clang/include',
  '-I',
  '.',
  '-I',
  './ClangCompleter',
  '-isystem',
  './tests/gmock/gtest',
  '-isystem',
  './tests/gmock/gtest/include',
  '-isystem',
  './tests/gmock',
  '-isystem',
  './tests/gmock/include',
  #C default header
  '-isystem',
  '/usr/lib/gcc/x86_64-linux-gnu',
  '-isystem',
  '/usr/lib/gcc/x86_64-linux-gnu/5/include',
  '-isystem',
  '/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed',
  '-isystem',
  '/usr/local/include',
  '-isystem',
  '/usr/include',

Solution

  • Look at the very beginning:

    '-std=c11',
    '-x',
    'c'
    '-isystem',
    

    Last two items become c-isystem (see :YcmDebug output). It may confuse compiler. I guess you meant -c instead. Nevertheless such flag is redundant for YouCompleteMe and may be omitted safely.

    P.S. C++ headers confuse C compiler too, so you need to ensure that provided headers are consistent with current source file type (is it C or C++).