YouCompleteMe Header Files

I work with some C ++ header files using YouCompleteMe. The header file does not contain all the other header files that it needs to find all the classes that it uses. Without changing the header file, can I change the .ycm_extra_conf.py file to know about the additional header files that it needs?

As an example, suppose I have three files "Ah", "Bh" and "C.cc".

C.cc

#include "Ah" #include "Bh" 

hijras

 class A {}; 

Bh

 class B : A {}; 

File B containing the file cannot compile it on its own, but C.cc will compile correctly because it includes things in the correct order. However, if I open Bh on it, he will complain that A is undefined.

I know that C.cc compiles correctly, so how can I tell YCM when opening Bh to compile it in the same context that it would use for C.cc? The flags seem insufficient to tell YCM how to compile the file, since it needs to be compiled with C.cc.

+7
c ++ vim
source share
1 answer

In your .ycm_extra_conf.py add the standard preprocessor flags, for example:

 flags = [ '-Wall', '-Wextra', '-Wno-variadic-macros', '-fexceptions', '-DNDEBUG', '-DUNIT_TESTS', '-std=c++11', '-x', 'c++', '-isystem', '/home/sehe/custom/boost', '-isystem', '/usr/lib/gcc/x86_64-linux-gnu/4.8/include', '-I', 'src', '-I', 'include', '-isystem', '/usr/include', '-isystem', '/usr/local/include', ] 
+4
source share

All Articles