Document your c ++ code in ten minutes-doxygen

Source: Internet
Author: User
Tags doxygen

Vs2003, vs2005, and Java are all equipped with code-based documentation tools. Do you want to have such a cool tool in vc6? This article will make your dream come true. It only takes 10 minutes. :)

Before you document your code, you may have the following questions:
I. Why do I need software documents?
1. Your company may need some documents.
2. If half a year passes, do you still recognize your code?
3. Your colleagues may often bother you. "Why do you write this code like this ?? ".
4. You may be about to leave the company or retire, but you don't want your code to be thrown into the trash. After all, this is your painstaking effort.
5. You need it.

2. Why is automated document generation tools used?
1. You may change your comments at any time, such as the function description. If you do not use an automated tool, open your word document to find the function description and change it.
2. reuse your comments.
3. automatically help you format your documents and associate them with hyperlinks.
4. Although your code contains important information, more important information is hidden in your comments. These comments will affect your colleagues, testers of your program, and your managers.

3. Why doxygen?
1. Because it is free, open-source, and configurable. The current version is 1.4.7. You can download it at the following address:
Http://www.doxygen.org/download.html

 

Okay. If you have answered all the above questions, let's see how to use doxygen.

Write comments in a specific format in your code:
1. Use /// annotation, for example:

/// This is a struct
/// It is used to obtain information about a rectangle.
Struct snapinfo
{
//...
}

2. Use
/**

*/
For example:

/**
This is a class
*/
Class Chi
{
//...
}

There are other annotations. For more information, see the help documentation of doxygen.

3. Copy the following text to the specified file (gendoc. BAT and default. doxygen)

Content in the gendoc. BAT file:

"D:/program files/doxygen/bin/doxygen.exe" Default. doxygen

Note: D:/program files/doxygen/bin/doxygen.exe is only the path for installing doxygen. You can select your own installation path.

Contents in the default. doxygen File

# Doxyfile 1.3-RC2

#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
Project_name = project name
Project_number =
Output_directory =
Output_language = Chinese
Extract_all = Yes
Extract_private = No
Extract_static = Yes
Extract_local_classes = Yes
Hide_undoc_members = No
Hide_undoc_classes = No
Hide_friend_compounds = No
Hide_in_body_docs = No
Brief_member_desc = Yes
Repeat_brief = Yes
Always_detailed_sec = No
Inline_inherited_memb = No
Full_path_names = No
Strip_from_path =
Internal_docs = No
Case_sense_names = Yes
Short_names = No
Hide_scope_names = No
Verbatim_headers = Yes
Show_shortde_files = Yes
Javadoc_autobrief = Yes
Multiline_cpp_is_brief = No
Details_at_top = Yes
Inherit_docs = No
Inline_info = Yes
Sort_member_docs = No
Distribute_group_doc = Yes
Tab_size = 8
Generate_todolist = Yes
Generate_testlist = Yes
Generate_buglist = Yes
Generate_deprecatedlist = Yes
Aliases =
Enabled_sections =
Max_initializer_lines = 30
Optimize_output_for_c = Yes
Optimize_output_java = No
Show_used_files = Yes
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
Quiet = No
Warnings = Yes
Warn_if_unmarshented = Yes
Warn_if_doc_error = Yes
Warn_format = "$ file ($ line): $ text"
Warn_logfile =
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
Input =.
File_patterns = *. CPP/
*. C/
*. H/
*. Cxx/
*. IDL
Recursive = Yes
Exclude =
Exclude_symlinks = No
Exclude_patterns =
Example_path =
Example_patterns =
Example_recursive = No
Image_path =
Input_filter =
Filter_source_files = No
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
Source_browser = Yes
Inline_sources = No
Strip_code_comments = Yes
Referenced_by_relation = No
References_relation = No
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
Alphabetical_index = Yes
Cols_in_alpha_index = 4
Ignore_prefix =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
Generate_html = Yes
Html_output = doxydoc
Html_file_extension =. html
Html_header =
Html_footer =
Html_stylesheet =
Html_align_members = Yes
Generate_htmlhelp = No
Chm_file =
Hhc_location =
Generate_chi = No
Binary_toc = No
Toc_expand = No
Disable_index = No
Enum_values_per_line = 4
Generate_treeview = No
Treeview_width = 250
#---------------------------------------------------------------------------
# Configuration options related to the latex output
#---------------------------------------------------------------------------
Generate_latex = Yes
Latex_output = Latex
Latex_1__name = Latex
Makeindex_1__name = makeindex
Compact_latex = No
Paper_type = a4wide
Extra_packages =
Latex_header =
Pai_hyperlinks = No
Use_pdflatex = No
Latex_batchmode = No
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
Generate_rtf = No
Rtf_output = RTF
Compact_rtf = No
Rtf_hyperlinks = No
Rtf_stylesheet_file =
Rtf_extensions_file =
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
Generate_man = No
Man_output = man
Man_extension =. 3
Man_links = No
#---------------------------------------------------------------------------
# Configuration options related to the XML output
#---------------------------------------------------------------------------
Generate_xml = No
Xml_schema =
Xml_dtd =
#---------------------------------------------------------------------------
# Configuration options for the autogen definitions output
#---------------------------------------------------------------------------
Generate_autogen_def = No
#---------------------------------------------------------------------------
# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
Generate_perlmod = No
Perlmod_latex = No
Perlmod_pretty = Yes
Perlmod_makevar_prefix =
#---------------------------------------------------------------------------
# Configuration options related to the Preprocessor
#---------------------------------------------------------------------------
Enable_preprocessing = Yes
Macro_expansion = No
Expand_only_predef = No
Search_shortdes = Yes
Include_path =
Include_file_patterns =
Predefined =
Expand_as_defined =
Skip_function_macros = Yes
#---------------------------------------------------------------------------
# Configuration: addtions related to external references
#---------------------------------------------------------------------------
Tagfiles =
Generate_tagfile =
Allexternals = No
External_groups = Yes
Perl_path =/usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot Tool
#---------------------------------------------------------------------------
Class_diagrams = Yes
Hide_undoc_relations = Yes
Have_dot = No
Class_graph = Yes
Collaboration_graph = Yes
Template_relations = Yes
Include_graph = Yes
Included_by_graph = Yes
Graphical_hierarchy = Yes
Dot_image_format = PNG
Dot_path =
Dotfile_dirs =
Max_dot_graph_width = 1024
Max_dot_graph_height = 1024
Generate_legend = Yes
Dot_cleanup = Yes
#---------------------------------------------------------------------------
# Configuration: addtions related to the search engine
#---------------------------------------------------------------------------
Searchengine = No
Cgi_name = search. cgi
Cgi_url =
Doc_url =
Doc_abspath =
Bin_abspath =/usr/local/bin/
Ext_doc_paths =

Okay, with the two files above, you just need to copy them in your vc6 project directory and then execute gendoc. bat. Oh, don't forget to change project_name in default. doxygen to your project name!
Now, let's look at the document generation! Don't be scared! Haha!
Note: Do not place the project on the desktop. It seems that doxygen does not recognize the Chinese path.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.