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

Loading libclang failed, completion won't be available #475

Closed DrompiX closed 8 years ago

DrompiX commented 8 years ago

I have this message : Loading libclang failed, completion won't be available. Are you sure 'C:\LLVM\lib' contains libclang?

I'm sure that i have libclang.lib in this directory. (I can't understand for which file i should write let g:clang_library_path='' , libclang.dll or libclang.py or libclang.py ?)

Than i wrote 'print e' in libclang.py and got message : "To provide a path to libclang use Config.set_library_path() or Config.set_library_file().

Vim version : 7.4 Included patches : 1-936

_vimrc :

let g:clang_exec='C:\LLVM\bin\clang.exe' let g:clang_library_path='C:\LLVM\lib'

I'm only studing to use Vim. Sorry for my english. I hope you will help me =)

xaizek commented 8 years ago

I'm sure that i have libclang.lib in this directory.

.lib is a static library file, you need a dynamic library, a .dll. Static libraries cannot be loaded at runtime.

DrompiX commented 8 years ago

I changed it to 'C:\LLVM\bin' (Where is my libclang.dll situated), but it still don't work And now i have one more message : [Error 193] %1 <ed><e5> <ff><e2><eb><ff><e5><f2><f1><ff> <ef><f0><e8><eb><ee><e6><e5><ed><e5><ed><e8><e5><ec> Win32. and previous message too

xaizek commented 8 years ago

Maybe remove

let g:clang_exec='C:\LLVM\bin\clang.exe'

line, that error has something to do with running a program, so this option might be related.

It also might be about unsupported format, e.g. 32-bit library and 64-bit Vim.

DrompiX commented 8 years ago

Nothing changed =(

xaizek commented 8 years ago

And everything is either 32-bit or 64-bit?

DrompiX commented 8 years ago

Yes, i changed LLVM to x64(like my Vim) and there is no errors. But now i have another problem... When i type, plugin doesn't complete my code (

xaizek commented 8 years ago

It should complete it when you hit <C-O><C-U>, auto-completion after ., -> and :: is disabled by default. You might also need to provide some configuration via .clang_complete file.

DrompiX commented 8 years ago

<C-O><C-U> doesn't work, only <C-P> and how can I enable auto-completion after ., -> and ::? And can it complete code in real time? Without touching any keys?

xaizek commented 8 years ago
doesn't work

Then you need configuration.

how can I enable auto-completion after ., -> and ::?

See.

And can it complete code in real time? Without touching any keys?

No, but I think some other plugins can enable this for clang_complete (maybe neocomplete, I don't really remember). There were some other completion plugins which can complete in real time.

DrompiX commented 8 years ago

Thank you very much!) And one more question (If u used C++) There is one container(i dont know right word in english) called 'vector'. It has parametres like .push_back(), .begin(), .end(), .size() and others but plugin doesn't complete it... (i included library)

xaizek commented 8 years ago

There is one container(i dont know right word in english) called 'vector'.

"container" is the right word.

It has parametres like .push_back(), .begin(), .end(), .size() and others but plugin doesn't complete it...

You probably need to create .clang_complete file containing something like:

-Ic:/path/to/c++/standard/library
DrompiX commented 8 years ago

I created .clang_complete and added there : -DDEBUG -IC:\mingw\lib\gcc\mingw32\5.1.0 (Also tried C:\mingw\lib\gcc\mingw32\5.1.0\include\c++ ) No any result

Should I add something in my _vimrc or other file? Thank's a lot

xaizek commented 8 years ago

I created .clang_complete and added there

It's where your source file is, right? You should be able to check whether options were picked up by the plugin using the following command after opening source file:

:echo b:clang_user_options

Also tried C:\mingw\lib\gcc\mingw32\5.1.0\include\c++

This should work, I guess. I don't really remember by now whether headers have to be from clang.

Should I add something in my _vimrc or other file?

Probably not, but you can try setting

let g:clang_debug = 1

and see if there will be something interesting in the output.

graywolf commented 8 years ago

Since you didn't hear back from DrompiX I take it this should be resolved than?

graywolf commented 8 years ago

3 down, 131 to go :D