Menu

How to include code segments in documentation

Owais
2014-10-27
2014-10-30
  • Owais

    Owais - 2014-10-27

    Hello,

    I have recently started using doxygen for code documentation. I would like to know if it is possible to include code segments into documentation created by doxygen. If this question has already been discussed please refer me to that topic. Thanks in advance.

    Regards,
    Owais

     
  • Owais

    Owais - 2014-10-29

    Thanks for your response Martin Svensson. I have looked into the above commands, I want to use the snippet command but I am not sure how to use it into my code so for example:

    // This is the code that I want to show in my documentation
    REG_PIOA_OER = 0x100000;

    So according to the snippet command description, I should do the following:

    //! [Adding a resource]
    REG_PIOA_OER = 0x100000;
    //! [Adding a resource]

    But what I don't understand is where to put the following and what about the path in it

    \snippet snippets/example.cpp Adding a resource

    How should I modify the above line and where should I place it in my code in order to generate the correct documentation. Thank in advance.

    Regards,
    Owais

     
  • Owais

    Owais - 2014-10-30

    Thanks, I am using \code ... \endcode and it works for me.

     

Log in to post a comment.