#272 Variables defined as "extern" within namespaces not found

open
nobody
None
5
2016-05-07
2010-03-21
Damien
No

I have some c++ code similar to the following format:

namespace MyNamespace {
...extern const MyClass My_Var;
}

However, running ctags (even with --c++-kinds=+x, which says it saves external declarations), My_Var is never found. However, if the extern modifier is removed, the variable is found just fine.

Discussion

  • Andrey Ponomarenko

    Hello,

    How did you resolve the issue?

    Thank you.

     
  • Masatake YAMATO

    Masatake YAMATO - 2016-05-07

    Newly written C++ paresr in universal-ctags can capture MY_Var.

    [yamato@x201]/tmp% cat /tmp/foo.cpp 
    namespace MyNamespace {
      extern const MyClass My_Var;
    }
    [yamato@x201]/tmp% ctags --version | head -1
    Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
    [yamato@x201]/tmp% ctags -o - --c++-kinds=+x foo.cpp 
    ctags -o - --c++-kinds=+x foo.cpp 
    MyNamespace foo.cpp /^namespace MyNamespace {$/;"   n   file:
    [yamato@x201]/tmp% ~/bin/u-ctags --version | head -1
    Universal Ctags 0.0.0(f4ff979), Copyright (C) 2015 Universal Ctags Team
    [yamato@x201]/tmp% u-ctags -o - --c++-kinds=+x foo.cpp 
    MyNamespace foo.cpp /^namespace MyNamespace {$/;"   n   file:
    My_Var  foo.cpp /^  extern const MyClass My_Var;$/;"    x   namespace:MyNamespace   typeref:typename:const MyClass
    [yamato@x201]/tmp% 
    
     

Log in to post a comment.