1 /******************************************************************************
5 * Copyright (C) 1997-2012 by Dimitri van Heesch.
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation under the terms of the GNU General Public License is hereby
9 * granted. No representations are made about the suitability of this software
10 * for any purpose. It is provided "as is" without express or implied warranty.
11 * See the GNU General Public License for more details.
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
17 /*! \page starting Getting started
20 The executable \c doxygen is the main program that parses the sources and
21 generates the documentation. See section \ref doxygen_usage for more
22 detailed usage information.
24 Optionally, the executable \c doxywizard can be used, which is a
25 \ref doxywizard_usage "graphical front-end" for editing the configuration file
26 that is used by doxygen and for running doxygen in a graphical environment.
27 For Mac OS X doxywizard will be started by clicking on the Doxygen application
30 The following figure shows the relation between the tools and the flow
31 of information between them (it looks complex but that's only because it
32 tries to be complete):
34 \image html infoflow.png "Doxygen information flow"
35 \image latex infoflow.eps "Doxygen information flow" width=14cm
37 \section step0 Step 0: Check if doxygen supports your programming language
39 First, assure that your programming language has a reasonable chance of being
40 recognized by Doxygen. These languages are supported by default: C, C++, C#,
41 Objective-C, IDL, Java, VHDL, PHP, Python, Tcl, Fortran, and D. It
42 is possible to configure certain file type extensions to use certain parsers:
43 see the \ref cfg_extension_mapping "Configuration/ExtensionMappings" for details.
44 Also, completely different languages can be supported by using preprocessor
45 programs: see the <a href="http://www.doxygen.org/helpers.html">Helpers page</a>
48 \section step1 Step 1: Creating a configuration file
50 Doxygen uses a configuration file to determine all of its settings.
51 Each project should get its own configuration file. A project can consist
52 of a single source file, but can also be an entire source tree that is
55 To simplify the creation of a configuration file, doxygen can create a
56 template configuration file for you. To do this call \c doxygen
57 from the command line with the \c -g option:
59 doxygen -g <config-file>
62 where \<config-file\> is the name of the configuration file. If you omit
63 the file name, a file named \c Doxyfile will be created. If a file with the
64 name \<config-file\> already exists, doxygen will rename it to
65 \<config-file\>.bak before generating the configuration template.
66 If you use <code>-</code> (i.e. the minus sign) as the file name then
67 doxygen will try to read the configuration file from standard
68 input (<code>stdin</code>), which can be useful for scripting.
70 The configuration file has a format that is similar to that of a (simple)
71 Makefile. It consists of a number of assignments (tags) of the form:
73 <tt>TAGNAME = VALUE</tt> or <br>
74 <tt>TAGNAME = VALUE1 VALUE2 ... </tt><br>
76 You can probably leave the values of most tags in a generated template
77 configuration file to their default value. See section \ref config for
78 more details about the configuration file.
80 If you do not wish to edit the config file with a text editor, you should
81 have a look at \ref doxywizard_usage "doxywizard", which is a GUI
82 front-end that can create, read and write doxygen configuration files,
83 and allows setting configuration options by entering them via dialogs.
85 For a small project consisting of a few C and/or C++ source
86 and header files, you can leave
87 \ref cfg_input "INPUT" tag empty and doxygen will search for sources in
88 the current directory.
90 If you have a larger project consisting of a source directory or tree
91 you should assign the root directory or
92 directories to the \ref cfg_input "INPUT" tag, and add one or more file
93 patterns to the \ref cfg_file_patterns "FILE_PATTERNS" tag
94 (for instance `*.cpp *.h`). Only files that match one of the
95 patterns will be parsed (if the patterns are omitted a list of
96 typical patterns is used for the types of files doxygen supports).
97 For recursive parsing of a source tree you must set
98 the \ref cfg_recursive "RECURSIVE" tag to \c YES. To further fine-tune the
99 list of files that is parsed the \ref cfg_exclude "EXCLUDE" and
100 \ref cfg_exclude_patterns "EXCLUDE_PATTERNS" tags can be used.
101 To omit all \c test directories from a source tree for instance, one could use:
103 \verbatim EXCLUDE_PATTERNS = */test/*
106 Doxygen looks at the file's extension to determine how to parse a file,
107 using the following table:
137 Any other extension is parsed as if it is a C/C++ file.
140 If you start using doxygen for an existing project (thus without any
141 documentation that doxygen is aware of), you can still get an idea of
142 what the structure is and how the documented result would look like.
143 To do so, you must set
144 the \ref cfg_extract_all "EXTRACT_ALL" tag in the configuration file
145 to \c YES. Then, doxygen will pretend everything in your sources is documented.
146 Please note that as a consequence warnings about undocumented members
147 will not be generated as long as \ref cfg_extract_all "EXTRACT_ALL" is
150 To analyze an existing piece of software it is useful to cross-reference
151 a (documented) entity with its definition in the source files. Doxygen will
152 generate such cross-references if you set
153 the \ref cfg_source_browser "SOURCE_BROWSER" tag to \c YES.
154 It can also include the sources directly into the documentation by setting
155 \ref cfg_inline_sources "INLINE_SOURCES" to \c YES (this can be handy for
156 code reviews for instance).
158 \section step2 Step 2: Running doxygen
160 To generate the documentation you can now enter:
162 doxygen <config-file>
165 Depending on your settings doxygen will create \c html, \c rtf,
166 \c latex, \c xml and/or \c man directories inside the output directory.
167 As the names suggest these directories contain the
168 generated documentation in HTML, RTF, \f$\mbox{\LaTeX}\f$, XML and
169 Unix-Man page format.
171 The default output directory is the directory in which \c doxygen
172 is started. The root directory to which the output is written can be changed
173 using the \ref cfg_output_directory "OUTPUT_DIRECTORY". The format specific
174 directory within the output directory can be selected using the
175 \ref cfg_html_output "HTML_OUTPUT", \ref cfg_rtf_output "RTF_OUTPUT",
176 \ref cfg_latex_output "LATEX_OUTPUT", \ref cfg_xml_output "XML_OUTPUT",
177 and \ref cfg_man_output "MAN_OUTPUT"
178 tags of the configuration file. If the output directory does not exist,
179 \c doxygen will try to create it for you (but it will \e not try to create
180 a whole path recursively, like <code>mkdir -p</code> does).
182 \subsection html_out HTML output
184 The generated HTML documentation can be viewed by pointing a HTML browser
185 to the \c index.html file in the \c html directory. For the best results
186 a browser that supports cascading style sheets (CSS) should be used
187 (I'm using Mozilla Firefox, Google Chrome, Safari, and sometimes
188 IE8, IE9, and Opera to test the generated output).
190 Some of the features the HTML section (such as
191 \ref cfg_generate_treeview "GENERATE_TREEVIEW" or the search engine)
192 require a browser that supports Dynamic HTML and Javascript enabled.
194 \subsection latex_out LaTeX output
196 The generated \f$\mbox{\LaTeX}\f$ documentation must first be compiled by
197 a \f$\mbox{\LaTeX}\f$ compiler (I use a recent teTeX distribution for Linux
198 and MacOSX and MikTex for Windows).
199 To simplify the process of compiling the generated
200 documentation, \c doxygen writes a \c Makefile into the \c latex directory
201 (on the Windows platform also a \c make.bat batch file is generated).
203 The contents and targets in the \c Makefile depend on the setting of
204 \ref cfg_use_pdflatex "USE_PDFLATEX". If it is disabled (set to \c NO), then
205 typing \c make in the \c latex directory a \c dvi file called \c refman.dvi
206 will be generated. This file can then be viewed using \c xdvi or
207 converted into a PostScript file \c refman.ps by
208 typing `make ps` (this requires `dvips`).
210 To put 2 pages on one physical page use `make ps_2on1` instead.
211 The resulting PostScript file can be send to a PostScript
212 printer. If you do not have a PostScript printer, you can try to use
213 ghostscript to convert PostScript into something your printer understands.
215 Conversion to PDF is also possible if you have installed the ghostscript
216 interpreter; just type `make pdf` (or `make pdf_2on1`).
218 To get the best results for PDF output you should set
219 the \ref cfg_pdf_hyperlinks "PDF_HYPERLINKS"
220 and \ref cfg_use_pdflatex "USE_PDFLATEX" tags to \c YES.
221 In this case the \c Makefile will only contain a target to build
222 \c refman.pdf directly.
224 \subsection rtf_out RTF output
226 Doxygen combines the RTF output to a single file called refman.rtf. This
227 file is optimized for importing into the Microsoft Word. Certain information
228 is encoded using so called fields. To show the actual value you need to
229 select all (Edit - select all) and then toggle fields (right click and select
230 the option from the drop down menu).
232 \subsection xml_out XML output
234 The XML output consists of a structured "dump" of the information gathered
235 by doxygen. Each compound (class/namespace/file/...) has its own XML file
236 and there is also an index file called `index.xml`.
238 A file called `combine.xslt`
239 XSLT script is also generated and can be used to combine all XML files
242 Doxygen also generates two XML schema files `index.xsd`
243 (for the index file) and `compound.xsd` (for the compound files).
244 This schema file describes the possible elements, their attributes and
245 how they are structured, i.e. it the describes the grammar of the XML
246 files and can be used for validation or to steer XSLT scripts.
248 In the `addon/doxmlparser` directory you can find a parser library for reading
249 the XML output produced by doxygen in an incremental way
250 (see `addon/doxmlparser/include/doxmlintf.h` for the interface of the library)
252 \subsection man_out Man page output
253 The generated man pages can be viewed using the \c man program. You do need
254 to make sure the man directory is in the man path (see the \c MANPATH
255 environment variable). Note that there are some limitations to the
256 capabilities of the man page format, so some information
257 (like class diagrams, cross references and formulas) will be lost.
259 \section step3 Step 3: Documenting the sources
261 Although documenting the sources is presented as step 3, in a new project
262 this should of course be step 1. Here I assume
263 you already have some code and you want doxygen to generate a nice document
264 describing the API and maybe the internals and some related design
265 documentation as well.
267 If the \ref cfg_extract_all "EXTRACT_ALL" option is set to \c NO in the
268 configuration file (the default), then doxygen will only generate
269 documentation for \e documented entities. So
270 how do you document these? For members, classes and namespaces there are
271 basically two options:
272 1. Place a \e special documentation block in front of the declaration or
273 definition of the member, class or namespace. For file, class and namespace
274 members it is also allowed to place the documentation directly after the
277 See section \ref specialblock to learn more about special
278 documentation blocks.
279 2. Place a special documentation block somewhere else (another file or
280 another location) \e and put a <em>structural command</em> in the
281 documentation block. A structural command links a documentation block
282 to a certain entity that can be documented (e.g. a member, class,
285 See section \ref structuralcommands to learn more
286 about structural commands.
288 The advantage of the first option is that you do not have to repeat the
291 Files can only be documented using the second option, since there is
292 no way to put a documentation block before a file. Of course, file members
293 (functions, variables, typedefs, defines) do not need an explicit
294 structural command; just putting a special documentation block in front or
295 behind them will work fine.
297 The text inside a special documentation block is parsed
298 before it is written to the HTML and/or \f$\mbox{\LaTeX}\f$ output files.
301 During parsing the following steps take place:
302 - Markdown formatting is replaced by corresponding HTML or special
304 - The special commands inside the documentation are executed. See
305 section \ref commands for an overview of all commands.
306 - If a line starts with some whitespace followed by one or more asterisks
307 (`*`) and then optionally more whitespace,
308 then all whitespace and asterisks are removed.
309 - All resulting blank lines are treated as a paragraph separators.
310 This saves you from placing new-paragraph commands yourself
311 in order to make the generated documentation readable.
312 - Links are created for words corresponding to documented classes
313 (unless the word is preceded by a \%; then the word will not be linked and
314 the \% sign is removed).
315 - Links to members are created when certain patterns are found in the
316 text. See section \ref autolink
317 for more information on how the automatic link generation works.
318 - HTML tags that are in the documentation are interpreted and converted
319 to \f$\mbox{\LaTeX}\f$ equivalents for the \f$\mbox{\LaTeX}\f$ output.
320 See section \ref htmlcmds for an overview of all supported HTML tags.
323 Go to the <a href="docblocks.html">next</a> section or return to the
324 <a href="index.html">index</a>.