GNU Global and GTAGS cannot find class definitions

I am having trouble getting the global definition of classes / structs. I can find them with exuberant ctags and cscope. All tag files are generated from the same source file. I configured and built a global, et.al., with only -prefix. configure found exhuberant and is using it. Over the past years, I have periodically encountered global problems and I have always had this problem. Any ideas?

thanks davep

+3


source to share


2 answers


Just export that variable and it should pretty much do it. The man page for gtags

-



GTAGSFORCECPP If this variable is set, each file whose suffix is 'h' is treated as a C++ source file.

+6


source


I figured out what I did wrong. Maybe this will help someone.

  • Just because configure finds exuberant ctags doesn't mean that it makes it the default parser. My ex ctags don't support --gtags and maybe that's why. In my case, the default parser was native / builtin.
  • The native parser treats .h as C only and does not look for C ++ constructs. Oddly enough, it also finds no structure.

I found 2 fixes:

1) The best thing if you have exuberant ctags is to make it the default. The exclusive configuration by default handles .h files. If not, use method 2. In .globalrc, change

default:\   
  :tc=native:

to 

default:\   
  :tc=ctags:

      



2) If you don't have exuberant ctags, edit .globalrc and change the langmap line for inline-parser from

builtin-parser:\
 :langmap=c\:.c.h,yacc\:.y,asm\:.s.S,java\:.java,cpp\:.c++.cc.hh.cpp.cxx.hxx.hpp.C.H,php\:.php.php3.phtml:

to

builtin-parser:\
 :langmap=c\:.c,yacc\:.y,asm\:.s.S,java\:.java,cpp\:.c++.cc.hh.h.cpp.cxx.hxx.hpp.C.H,php\:.php.php3.phtml:

      

those. remove the .h association with C and link with C ++. This can cause problems with Ch files. If this is the case, you may need to rename ALL C ++. H files to .hh, .hpp, .hxx, etc. as indicated in langmap.

Based on my experience with C ++, it looks like most people still use .h for their header files.

+5


source







All Articles