I just compiled and installed Vim, Vundle and YouCompleteMe plugin according to the introduction on Github. But the YouCompleteMe plugin doesn't work well in my Vim. It can auto complete the variable's name but it doesn't auto complete the operation of STL objects (vector, map). It can't even auto complete the "this->" in a class. It always tells me "(^U^N^P) Pattern not found." Have you guys seen this before? I use Ubuntu 12.04. What should I do?
The readme on the github repo for the plugin now addresses the issue.
This is caused by an issue with libclang. Compiling from clang the binary uses the correct default header search paths but compiling from libclang.so does not. The issue seems to impact some OS's more than others. It appears that OS X Mavericks in particular has problems with this.
The current workaround is to call echo | clang -v -E -x c++ - and look at the paths under the #include <...> search starts here: heading. You should take those paths, prepend -isystem to each individual path and append them all to the list of flags you return from your FlagsForFile function in your .ycm_extra_conf.py file.
You might also want to take a look at the corresponding issue
I came here looking for the answer as well, I don't know python and have never hacked on something else before. So here is how I went about it.
Find the error message. I went to ~/.vim/bundle/YouCompleteMe and grepped for "builtin includes" . Why? because that is part of the error message
Modified Error message to ensure that this file was being run (my initials NxD) - worked.
getBuiltinHeaderPath runs a loop on known directories. I have 2 clang installations
I added both the paths to this array : knownPaths
"/usr/local/include",
"/usr/local/lib/clang/3.3",
"/home/nxd/Downloads/clang+llvm-3.2-x86_64-linux-ubuntu-12.04/clang/3.2"
I noted that "," is the separator of array elements in python. I also earlier noted that print -> puts a message out in python and arguments are c-style %s, %d etc work - (that's how the "builtin include" message came on the screen in the first place)
I also dumped some print statements into the loop so see what it was seeing and what it was doing.
part code modified function "getBuiltinHeaderPath"
print "active path from knownPaths is |%s|" %path
files = os.listdir(path)
print " files in path is |%s|" % files
print " len (files) is |%d|" % len(files)
if len(files) >= 1:
files = sorted(files)
subDir = files[-1]
else:
subDir = '.'
# nxd -
subDir = '.'
path = path + "/" + subDir + "/include/"
print " len (files) is |%d|" % len(files)
print " files[-1] is |%s|" % files[-1]
print "searching in path : |%s| " % path
I realised that the expected behaviour of files[-1] was not what the author intended and modified it after the if condition to stay unchanged.
Restart vim with a new cpp file and looked at :messages - It worked.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With