---
name: "gctags"
section: "1"
platform: "linux"
package: "global"
version: "4.5-1.1"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/gctags"
---

# gctags(1)

print cross reference list for gtags.

## NAME

gctags - print cross reference list for gtags.

## SYNOPSIS

**gctags** \[-bdenrsvw\] *file* ...\

## DESCRIPTION

**Gctags** print cross reference list for [**gtags**(1)](/gtags/1.md) from the specified C, C++, YACC, JAVA and assembler source to standard output. Each line of output contains the object name, the line number which it appears, the file in which it is defined, and a line image separated by white-space. It's same with the output of [**ctags**(1)](/ctags/1.md) with **-x** option.

Depending upon the options provided to **gctags**, objects will consist of function definitions, function references and other symbols.

Files whose names end in ´.c´ or ´.h´ are assumed to be C source files and are searched for C style routine and macro definitions. Files whose names end in ´.c++´ ´.cc´ ´.cpp´ ´.cxx´ ´.hxx´ ´.C´ ´.H´ are assumed to be C++ source files. Files whose names end in ´.y´ are assumed to be YACC source files. Files whose names end in ´.java´ are assumed to be Java source files. Files whose names end in ´.s´ or ´.S´ are assumed to be Assembler source files. Other files are searched for C style definitions.

Yacc files each have a special tag. **yyparse** is the start of the second section of the yacc file.

This command is the default parser of GLOBAL source code tag system.

## OPTIONS

The following options are available:

- **-b**, **--begin-block**

  Force level 1 block to begin when reach a left brace at the first column. (C only)

- **-d**, **--define**

  Pick up not only function but also macro without argument as a definition.

- **-e**, **--end-block**

  Force level 1 block to end when reach a right brace at the first column. (C only)

- **-n**, **--no-tags**

  Suppress output of tags. It is useful to use with **-w** option.

- **-r**, **--reference**

  Locate function references instead of function definitions. ´GTAGS´ is needed at the current directory. (C, C++ and Java source only) By default, locate function definitions.

- **-s**, **--symbol**

  Collect symbols other than functions. By default, locate function definitions.

- **-v**, **--verbose**

  Verbose mode.

- **-w**, **--warning**

  Print warning message.

- **--langmap**=map

  Language mapping. Each comma-separated  map  consists of the language name, a colon, and a list of file extensions. Default mapping is 'c:.c.h,yacc:.y,asm:.s.S,java:.java,cpp:.c++.cc.cpp.cxx.hxx.C.H'.

The **-r** and **-s** options override each other; the last one specified determines the method used.

## DIAGNOSTICS

**Gctags** exits with a non 0 value if an error occurred, 0 otherwise. Duplicate objects are not considered errors.

## SEE ALSO

[**btreeop**(1)](/btreeop/1.md), [**global**(1)](/global/1.md), [**gtags**(1)](/gtags/1.md), [**htags**(1)](/htags/1.md).

GNU GLOBAL source code tag system\
 (http://www.gnu.org/software/global/).

## BUG

**Gctags** relies on the input being well formed, and any syntactical errors will completely confuse it.

Assembler support is far from complete.  It extracts only ENTRY() and ALTENTRY() from source file. Probably valid only for FreeBSD and Linux kernel source.

## AUTHOR

Shigio Yamaguchi

## HISTORY

The **gctags** command appeared in FreeBSD 2.2.2.
