0

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.

1
  • 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
1

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:
 /usr/bin/../lib/gcc/i686-linux-gnu/7.4.0/../../../../include/c++/7.4.0
 /usr/bin/../lib/gcc/i686-linux-gnu/7.4.0/../../../../include/i386-linux-gnu/c++/7.4.0
 /usr/bin/../lib/gcc/i686-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward
 /usr/include/clang/8.0.0/include
 /usr/local/include
 /usr/include/i386-linux-gnu
 /usr/include
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 = [
 # ...
 '-isystem',
 '/usr/bin/../lib/gcc/i686-linux-gnu/7.4.0/../../../../include/c++/7.4.0',
 '-isystem',
 '/usr/bin/../lib/gcc/i686-linux-gnu/7.4.0/../../../../include/i386-linux-gnu/c++/7.4.0',
 '-isystem',
 '/usr/bin/../lib/gcc/i686-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward',
 # ...
]

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.