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

error when installed from vundle #442

Closed nickdesaulniers closed 9 years ago

nickdesaulniers commented 9 years ago

I've installed this package via vundle.

When I type a dot after an instance of an object, I get:

Error detected while processing function ClangComplete:
line   22:
Traceback (most recent call last):

and when vim starts for a cpp file, I see a quick flash: screen_shot_2015-02-06_at_10_11_18_am

nickdesaulniers commented 9 years ago

possible duplicate #264 ?

xaizek commented 9 years ago

possible duplicate #264 ?

Probably not, the last error is the result of the first one, which is different issue in your case.

I'm not sure what that error means, but if you run python and type in from ctypes import * and get same errors, it's python issue. Otherwise maybe Vim uses wrong python and you could try running :python from ctypes import * in Vim, in which case it's Vim's issue. It looks like some python thing just fails, clang_complete doesn't do much at this point, but I might be wrong.

nickdesaulniers commented 9 years ago

When I run the import from python, no issue. When I run it in Vim, I get:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/
__init__.py", line 10, in <module>
    from _ctypes import Union, Structure, Array
ImportError: dlopen(/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/pytho
n2.7/lib-dynload/_ctypes.so, 2): Symbol not found: __PyInt_AsInt
  Referenced from: /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python
2.7/lib-dynload/_ctypes.so
  Expected in: flat namespace
 in /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/_ctypes.so

From the readme:

You need Vim 7.3 or higher, compiled with python support and ideally, with
the conceal feature.

I am running vim 7.3, but I don't remember ever compiling it from source, but it's not listed from brew list | grep vim, so maybe I did at one point. which vim points to /usr/bin/vim and la /usr/bin/vim shows it as an exectuable, not a symlink, so I'm guessing I must still be using the default vim from OSX. Maybe I should try building vim myself and try again?

xaizek commented 9 years ago

If you have :python command, you do have Vim compiled with python, but I have no idea what this Cellar is and whether python under that path is the one that comes with OSX (the one system Vim should be compiled against). Rebuilding Vim might help, but I'm really not sure.

nickdesaulniers commented 9 years ago

homebrew puts installed binaries in Cellars (homebrew has all this drink related metaphors; cellars, casks, taps). Looks like I have a version of python installed with homebrew. Let me try removing it real quick.

nickdesaulniers commented 9 years ago

Working well, thanks for the help @xaizek ! Quick question, now when I auto complete an additional window is opened on top that I don't know how to close. Maybe if I knew more about vim, but any idea what this is or how I can prevent it or at least close it? screen shot 2015-02-06 at 1 12 35 pm

xaizek commented 9 years ago

Quick question, now when I auto complete an additional window is opened on top that I don't know how to close. Maybe if I knew more about vim, but any idea what this is or how I can prevent it or at least close it?

Try adding let g:clang_close_preview = 1 or set completeopt-=preview to your .vimrc. Use Ctrl-W O to close all windows except the current one, Ctrl-W C works as :q, navigation is Ctrl-W followed by h/j/k/l.

nickdesaulniers commented 9 years ago

set completeopt-=preview worked well, thanks so much!