1 /******************************************************************************
5 * Copyright (C) 1997-2015 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:
140 Any other extension is parsed as if it is a C/C++ file.
143 If you start using doxygen for an existing project (thus without any
144 documentation that doxygen is aware of), you can still get an idea of
145 what the structure is and how the documented result would look like.
146 To do so, you must set
147 the \ref cfg_extract_all "EXTRACT_ALL" tag in the configuration file
148 to \c YES. Then, doxygen will pretend everything in your sources is documented.
149 Please note that as a consequence warnings about undocumented members
150 will not be generated as long as \ref cfg_extract_all "EXTRACT_ALL" is
153 To analyze an existing piece of software it is useful to cross-reference
154 a (documented) entity with its definition in the source files. Doxygen will
155 generate such cross-references if you set
156 the \ref cfg_source_browser "SOURCE_BROWSER" tag to \c YES.
157 It can also include the sources directly into the documentation by setting
158 \ref cfg_inline_sources "INLINE_SOURCES" to \c YES (this can be handy for
159 code reviews for instance).
161 \section step2 Step 2: Running doxygen
163 To generate the documentation you can now enter:
165 doxygen <config-file>
168 Depending on your settings doxygen will create \c html, \c rtf,
169 \c latex, \c xml, \c man, and/or docbook directories inside the output directory.
170 As the names suggest these directories contain the
171 generated documentation in HTML, RTF, \LaTeX, XML,
172 Unix-Man page, and DocBook format.
174 The default output directory is the directory in which \c doxygen
175 is started. The root directory to which the output is written can be changed
176 using the \ref cfg_output_directory "OUTPUT_DIRECTORY". The format specific
177 directory within the output directory can be selected using the
178 \ref cfg_html_output "HTML_OUTPUT", \ref cfg_rtf_output "RTF_OUTPUT",
179 \ref cfg_latex_output "LATEX_OUTPUT", \ref cfg_xml_output "XML_OUTPUT",
180 \ref cfg_man_output "MAN_OUTPUT", and \ref cfg_docbook_output "DOCBOOK_OUTPUT".
181 tags of the configuration file. If the output directory does not exist,
182 \c doxygen will try to create it for you (but it will \e not try to create
183 a whole path recursively, like <code>mkdir -p</code> does).
185 \subsection html_out HTML output
187 The generated HTML documentation can be viewed by pointing a HTML browser
188 to the \c index.html file in the \c html directory. For the best results
189 a browser that supports cascading style sheets (CSS) should be used
190 (I'm using Mozilla Firefox, Google Chrome, Safari, and sometimes
191 IE8, IE9, and Opera to test the generated output).
193 Some of the features the HTML section (such as
194 \ref cfg_generate_treeview "GENERATE_TREEVIEW" or the search engine)
195 require a browser that supports Dynamic HTML and Javascript enabled.
197 \subsection latex_out LaTeX output
199 The generated \LaTeX documentation must first be compiled by
200 a \LaTeX compiler (I use a recent teTeX distribution for Linux
201 and MacOSX and MikTex for Windows).
202 To simplify the process of compiling the generated
203 documentation, \c doxygen writes a \c Makefile into the \c latex directory
204 (on the Windows platform also a \c make.bat batch file is generated).
206 The contents and targets in the \c Makefile depend on the setting of
207 \ref cfg_use_pdflatex "USE_PDFLATEX". If it is disabled (set to \c NO), then
208 typing \c make in the \c latex directory a \c dvi file called \c refman.dvi
209 will be generated. This file can then be viewed using \c xdvi or
210 converted into a PostScript file \c refman.ps by
211 typing `make ps` (this requires `dvips`).
213 To put 2 pages on one physical page use `make ps_2on1` instead.
214 The resulting PostScript file can be send to a PostScript
215 printer. If you do not have a PostScript printer, you can try to use
216 ghostscript to convert PostScript into something your printer understands.
218 Conversion to PDF is also possible if you have installed the ghostscript
219 interpreter; just type `make pdf` (or `make pdf_2on1`).
221 To get the best results for PDF output you should set
222 the \ref cfg_pdf_hyperlinks "PDF_HYPERLINKS"
223 and \ref cfg_use_pdflatex "USE_PDFLATEX" tags to \c YES.
224 In this case the \c Makefile will only contain a target to build
225 \c refman.pdf directly.
227 \subsection rtf_out RTF output
229 Doxygen combines the RTF output to a single file called refman.rtf. This
230 file is optimized for importing into the Microsoft Word. Certain information
231 is encoded using so called fields. To show the actual value you need to
232 select all (Edit - select all) and then toggle fields (right click and select
233 the option from the drop down menu).
235 \subsection xml_out XML output
237 The XML output consists of a structured "dump" of the information gathered
238 by doxygen. Each compound (class/namespace/file/...) has its own XML file
239 and there is also an index file called `index.xml`.
241 A file called `combine.xslt`
242 XSLT script is also generated and can be used to combine all XML files
245 Doxygen also generates two XML schema files `index.xsd`
246 (for the index file) and `compound.xsd` (for the compound files).
247 This schema file describes the possible elements, their attributes and
248 how they are structured, i.e. it the describes the grammar of the XML
249 files and can be used for validation or to steer XSLT scripts.
251 In the `addon/doxmlparser` directory you can find a parser library for reading
252 the XML output produced by doxygen in an incremental way
253 (see `addon/doxmlparser/include/doxmlintf.h` for the interface of the library)
255 \subsection man_out Man page output
257 The generated man pages can be viewed using the \c man program. You do need
258 to make sure the man directory is in the man path (see the \c MANPATH
259 environment variable). Note that there are some limitations to the
260 capabilities of the man page format, so some information
261 (like class diagrams, cross references and formulas) will be lost.
263 \subsection docbook_out DocBook output
265 Doxygen can also generate output in the
266 <a href="http://docbook.org/">DocBook</a> format. How to process the
267 DocBook output is beyond the scope of this manual.
269 \section step3 Step 3: Documenting the sources
271 Although documenting the sources is presented as step 3, in a new project
272 this should of course be step 1. Here I assume
273 you already have some code and you want doxygen to generate a nice document
274 describing the API and maybe the internals and some related design
275 documentation as well.
277 If the \ref cfg_extract_all "EXTRACT_ALL" option is set to \c NO in the
278 configuration file (the default), then doxygen will only generate
279 documentation for \e documented entities. So
280 how do you document these? For members, classes and namespaces there are
281 basically two options:
282 1. Place a \e special documentation block in front of the declaration or
283 definition of the member, class or namespace. For file, class and namespace
284 members it is also allowed to place the documentation directly after the
287 See section \ref specialblock to learn more about special
288 documentation blocks.
289 2. Place a special documentation block somewhere else (another file or
290 another location) \e and put a <em>structural command</em> in the
291 documentation block. A structural command links a documentation block
292 to a certain entity that can be documented (e.g. a member, class,
295 See section \ref structuralcommands to learn more
296 about structural commands.
298 The advantage of the first option is that you do not have to repeat the
301 Files can only be documented using the second option, since there is
302 no way to put a documentation block before a file. Of course, file members
303 (functions, variables, typedefs, defines) do not need an explicit
304 structural command; just putting a special documentation block in front or
305 behind them will work fine.
307 The text inside a special documentation block is parsed
308 before it is written to the HTML and/or \LaTeX output files.
311 During parsing the following steps take place:
312 - Markdown formatting is replaced by corresponding HTML or special
314 - The special commands inside the documentation are executed. See
315 section \ref commands for an overview of all commands.
316 - If a line starts with some whitespace followed by one or more asterisks
317 (`*`) and then optionally more whitespace,
318 then all whitespace and asterisks are removed.
319 - All resulting blank lines are treated as a paragraph separators.
320 This saves you from placing new-paragraph commands yourself
321 in order to make the generated documentation readable.
322 - Links are created for words corresponding to documented classes
323 (unless the word is preceded by a \%; then the word will not be linked and
324 the \% sign is removed).
325 - Links to members are created when certain patterns are found in the
326 text. See section \ref autolink
327 for more information on how the automatic link generation works.
328 - HTML tags that are in the documentation are interpreted and converted
329 to \LaTeX equivalents for the \LaTeX output.
330 See section \ref htmlcmds for an overview of all supported HTML tags.
333 Go to the <a href="docblocks.html">next</a> section or return to the
334 <a href="index.html">index</a>.