Skip to content

Instantly share code, notes, and snippets.

Last active Dec 18, 2019
What would you like to do?
Generating a ctags file for libstdc++

Generating a ctags file for libstdc++

Ripped off Stackoverflow and adapted to be version independent.

  • call the following script regularly via crontab

  • add the following line to $HOME/.vimrc:

    set tags+=$HOME/.cache/cpp_tags
#! /bin/bash
CXX_ABSPATH="`which $CXX`"
[ ! -x "$CXX_ABSPATH" ] && { echo "CXX \"$CXX\" is not executable." >&2; exit 1; }
ctags --quiet=yes -f $HOME/.cache/cpp_tags --c++-kinds=+UA --fields=+SaimKz --extras=+qf \
--langmap=c++:+.tcc. --languages=c++ -I "_GLIBCXX_NOEXCEPT _GLIBCXX_USE_NOEXCEPT \
-n --recurse=yes \
`$CXX_ABSPATH -xc++ -E -v /dev/null -o /dev/null 2>&1| sed -ne '/#include <...> search starts here:/,/End of search list./{//!p}'` 2> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment