I was trying to tag a C++ project with ctags
with the options as listed in this answer C++ source tagging. I am in a project tree that contains multiple folders and those folders contain source files. I have tried the following to tag the entire source tree
ctags --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ -R .
find . -type f \( -iname "*.cpp" -o -iname "*.hpp" \) | xargs ctags --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++
ctags -R .
ctags -R *
and all of the above give the same error
ctags: Failure on attempt to read file : Is a directory
How do I go about fixing this?
This permits running ctags on all files in either a single directory (e.g. “ ctags * ”), or on all files in an entire source directory tree (e.g. “ ctags -R ”), since only those files whose names are mapped to languages will be scanned. An extension may be mapped to multiple parsers.
As ctags considers each source file name in turn, it tries to determine the language of the file by applying tests described in “ Determining file language ”. If a language was identified, the file is opened and then the appropriate language parser is called to operate on the currently open file.
By default, ctags doesn’t create the inputFile / f extra tag for the source file when ctags doesn’t find a parser for it. Enabling Unknown parser with --languages=+Unknown forces ctags to create the extra tags for any source files.
These mappings can cause issues. ctags tries to select the proper parser for the source file by applying heuristics to its content, however it is not perfect. In case of issues one can use --language-force=<language> , --langmap=<map> [,<map> [...]], or the --map-<LANG>= [+|-]<extension>|<pattern> options.
Turns out this was a case insensitive filesystem problem. The MacOSX I am on has case insensitive files and as a result a folder named Tags
was affecting the ctags program. Removing the Tags
folder or causing ctags to output to another file with the -f
flag fixed the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With