Question

In trying to setup auto completion for C using clang complete in vim, and so far, when I'm inside a .c file, I kind of get auto completion when I hit ctrl+x,u. However it only displays some symbols.

None of the functions that's in the included headers appear in the auto complete popup box. It appears that only typedefs are showing?

enter image description here

The project structure is very simple:

$ tree -ap
.
├── [-rwxrw-r--]  .clang_complete
├── [-rwxrw-r--]  makefile
└── [drwxrw-r--]  src
    └── [-rwxrw-r--]  FlightControl.c

1 directory, 3 files

I tried creating the .clang_complete file inside the project folder, that contains the following:

-I/.../Libraries/xpSDK/CHeaders/XPLM

I double checked the path to the XPLM headers, and it is correct.

Any ideas whats wrong?

Was it helpful?

Solution

During completion libclang tries to do its best by ignoring errors to present a user with the longest list of matches. I guess that you don't have XPLM_API macro defined. As it is used to declare every function in headers, you won't see any functions in completion list. Looking at defines in XPLMDefs.h I think that libclang gets Platform not defined! error (maybe even several times).

It should work if you define your platform for completion, I did this by adding -DLIN to .clang_complete file and completion works now.

So it doesn't seem to be an issue of vim or clang_complete, though it'd be nice to have a warning in such case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top