Filling Vim Code Doesn't Work After Including Standard Header

I need to develop my project in debian linux text mode. I use Vim and I installed the clang_completion plugin on it. I created a .clang_completion file in the root directory of my project:

 -I. -I/usr/include -I/usr/include/c++/4.6 

When I write a program as shown below, the completion is excellent.

 //#include <stdio.h> int main() { struct A { int x, y; }; A a; a. // After putting dot, the suggestion popup appears return 0; } 

However, after deleting the comment of the first line, this will not work! How can I solve this problem?

+7
source share
2 answers

I found the easiest way to get clang_complete to work, to use the provided cc_args.py file.

when compiling a project, use clang_complete / bin / cc_args.py instead of gcc / g ++

This will create the correct .clang_complete file with all libraries and dependencies. Provide the clang_complete source directory in your home folder.

Makefile example:

 CXX=$(HOME)/clang_complete/bin/cc_args.py g++ all: $(CXX) main.cpp 
+1
source

I have successfully used the clang_complete plugin in the past (now I just use cscope and ctags, which I find enough).

Enabling external headers worked fine in my configuration, but as stated in the clang complete plugin page , the file in which to include the included paths (or any other flag that you might want to pass to the clang compiler) should be named .clang_complete , not .clang_completion .

In addition, I used options on a single line, just as I was going to pass the normal contents of the .clang_complete file as a command line parameter (I don’t know if splitting lines with \ work).

Hope this helps.

0
source

All Articles