YouCompleteMe worked fine until I upgrade Ubuntu from 16 to 18.

Now it doesn't understand using std::cin; saying

no member named 'cin' in namespace 'std'; did you mean 'min'?

It also doesn't read in class names defined in my own header files.

I have tried reinstalling YouCompleteMe, git pull the latest version, git submodule update.

I also verified/updated the path to libclang to /usr/lib/llvm-8/lib/libclang.so in .vimrc and the path to C++ standard library to /usr/include/c++/7/ in .vim/.ycm_extra_conf.py

All the C++ source code compiles without error with nearly identical compilation flags.

  • The question is not about how to write c++, but rather about a vim plugin YouCompleteMe which broke after Ubuntu upgrade. – Daniel Aug 19 '19 at 22:11

After following the README on YouCompleteMe github page and run

$ echo | clang -v -E -x c++ -
clang version 8.0.0-3~ubuntu18.04.1 (tags/RELEASE_800/final)
#include "..." search starts here:
#include <...> search starts here:
End of search list.

Go into ~/.vim/.ycm_extra_conf.py and add the paths after #include <...> search starts here: in the flags array with '-isystem' before each and removing the old includes.

flags = [
 # ...
 # ...

Restart vim and the issue is fixed.

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.