Use Doxygen to read and analyze C/+ + code under Windows
Transferred from: http://blog.sina.com.cn/s/blog_63d902570100gwk6.html
While it's easy to read and analyze C + + code in Windows using a variety of ides or source Insight, step-by-step go to definetion is painful. Doxygen can generate function call graphs, all function call relationships can be at a glance, in addition he can also statistical documents in all classes, member variables, member functions and so on. In general, Doxygen not only can grasp the code from the local, but also from the overall view of the code, the latter is the General IDE and source Insight can not do. Therefore, the use of Doxygen reading analysis code can achieve a multiplier effect.
The installation of Doxygen is simple enough to download the Doxygen Windows Installer to the official website. In addition to installing Doxygen, you need to install Graphviz because Doxygen needs to use Graphviz Dot.exe to generate the call graph. Graphviz can also be downloaded to the installation program on its official website. However, the installer I downloaded always reported a CAB file error during installation. Finally, I downloaded the Graphviz release file, which is the zip file under the installer, which can be extracted after the download is complete.
After you install Doxygen, you can make the appropriate configuration, and then run Doxyfile to generate the document. The basic configuration has been explained earlier, no longer repeat. It is important to note that:
1. To tick the Have_dot, call_graph, caller_graph options below the DOT tab. Under Dot_path, fill in the Dot.exe path, which is the Bin folder in the Graphviz installation directory.
2. Tick the scan recursively! under the Wizard->project tab
3. Tick the Extract_all, Extract_private, Extract_static, extract_local_classes, extract_local_methods options under the Build tab
4. If you have Chinese in the program, change the input_encoding under the Doxyfile_encoding and Input tabs under the Project tab to GBK
5. The latex output can be checked off, which saves compilation time
-
Doxygen is an open source software that can be used to extract software documents (HTML and other formats) from existing VC projects, including document descriptions, class descriptions, attribute method descriptions, and class relationships. Usually Doxygen and GraphThe Viz two software is installed together, which is a drawing software that adds a chart to a software document generated by the former. Doxygen's details can be searched online. Here is a personal experience, can help interested friends quickly get started with this software:
1, install Doxygen and GraphAfter the Viz, you can run Doxygen.exe-g under Doxygen installation directory in to generate a configuration file named Doxyfile.
2. Copy the file Doxyfile to the VC project directory where you want to generate the document.
Modify the following options in the file:
Project_Name = fill in the project name
Output_language = changed to Chinese
GENE RATe_latex = Change to No
EXT RACt_all = Change to Yes
Have_dot = Change to Yes
Dot_image_format = This is a JPG
Dot_path = Fill in "C:/pro GRAM files/att/ GraphViz/bin/"
Dotfile_dirs = Fill in "C:/pro GRAM files/att/ GraphViz/bin/"
3, the following modifications to the VC project
(1) Add pre-defined in stdAfx.h to support dot drawing.
#ifndef _dia GRAMs_a_h
#define _dia GRAMs_a_h
#endif
(2) Add annotations in front of important classes, methods, and attributes to support Doxygen analysis.
@brief the most important business implementation class
///
All of the algorithm content is basically implemented in this class.
///
@author Lipp
Or put it behind a statement.
Char sfilename[400]; < log file name
and add comments before important documents
@file Xxx.cpp
The DLL main program that implements the algorithm is called by other programs.
Includes each method output interface.
4, run DOXYGEN.exe. Load the Doxyfile file above. Click Start. A new HTML directory is generated in the VC project directory.
5. Use IE to open the index.htm file in the newly generated HTML directory.
Use Doxygen to read and analyze C/+ + code under Windows