Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim code completion doesn't work after including a standard header

I have to develop my project in text-mode debian linux. I'm using Vim and I installed the clang_completion plugin on it. I made .clang_completion file in root of my project :

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

When I write a program like below, the completion works fine.

//#include <stdio.h>
int main()
{
  struct A
  {
    int x, y;
  };

  A a;
  a. // After putting dot, the suggestion popup appears

  return 0;
}

However, after removing the comment of first line, it doesn't work! How can I overcome this issue?

like image 400
masoud Avatar asked Oct 29 '12 20:10

masoud


1 Answers

I found the easiest way to get clang_complete to work is 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 generate the correct .clang_complete file with all libraries and dependencies. Provided the clang_complete source directory in your home folder.

Example Makefile:

CXX=$(HOME)/clang_complete/bin/cc_args.py g++

all:
    $(CXX) main.cpp
like image 144
nonameentername Avatar answered Nov 13 '22 18:11

nonameentername