xavierd / clang_complete

Vim plugin that use clang for completing C/C++ code.
http://www.vim.org/scripts/script.php?script_id=3302
1.96k stars 308 forks source link

Can't find `limits.h` file even using libclang 3.6 #444

Closed albertnetymk closed 7 years ago

albertnetymk commented 9 years ago

Clang 3.5 has a bug related to limits.h, and it's fixed, so using libclang 3.6 should be already. However, with the same test file from that bug report:

#include <limits.h>

int main() {
  return 0;
}

I still got the error:

/usr/include/limits.h|123 col 16 error| 'limits.h' file not found

Don't know much about python, but I still had a look at plugin/libclang.py.

Surprisingly, if I change the origial line from:

  currentFile = ("test.c", '#include "stddef.h"')

to:

  currentFile = ("test.c", '#include "limits.h"')

The error msg is gone, and it seems to work as usual. Anyone knowledgable enough care to elaborate?

xaizek commented 9 years ago

Code you changed is used to verify that include directory is correct. Maybe stddef.h causes false positive at least in your setup. I didn't like that guessing ever, maybe library_path + "/../lib64/clang", is missing from the list, but I'm really not sure.

albertnetymk commented 9 years ago

@xaizek What's the result with the above test program? Does it work or give the same error msg, 'limits.h' not found?

xaizek commented 9 years ago

Seems to work as is here, but my system clang was 3.4.2, so I updated it to 3.6.0, which works as well. Maybe libclang.so you're using is left from 3.5.0 release?

albertnetymk commented 9 years ago

OK, that's weird. I am using xubuntu:

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:        14.04
Codename:       trusty

libclang.so doesn't exist in /usr/lib, so I have to create the symlink myself:

$ ls -l /usr/lib/libclang.so
lrwxrwxrwx 1 root root 37 maj 20 18:20 /usr/lib/libclang.so -> /usr/lib/llvm-3.6/lib/libclang-3.6.so

I have removed llvm-3.5 and libclang1-3.5 two packages.

euttsov commented 9 years ago

I have the same issue with libclang-3.6. I'm using Ubuntu Mate 15.04

albertnetymk commented 7 years ago

Using clang version 3.9.1-svn288847-1~exp1 (branches/release_39), I can't reproduce it any more.