插件的GitHub存储库上的自述文件现在解决了该问题。
这是由libclang引起的问题。从clang编译二进制文件使用了正确的默认头文件搜索路径,但从libclang.so编译时没有使用。该问题似乎对某些操作系统影响更大。特别是OS X Mavericks似乎有问题。
当前的解决方法是调用echo | clang -v -E -x c++ -,并查看在# include <...>搜索开始于:标题下的路径。您应该采取这些路径,并为每个单独路径添加-isystem前缀,然后将它们全部附加到您在.ycm_extra_conf.py文件中返回的标志列表中的FlagsForFile函数中。
您还可以查看相应的问题
我也在这里寻找答案,我不懂Python,以前也没有黑过其他的东西。那么这就是我解决问题的方法。
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.