Menu

C++ namespace elements generate duplicate label warnings in latex

Jakob En
2024-06-28
2024-06-28
  • Jakob En

    Jakob En - 2024-06-28

    Hi,

    I am having the following problem with doxygen (1.11.0) and Latex (MiKTeX-pdfTeX 4.19 (MiKTeX 24.4):

    I am trying to document C++ source, a minimal version to reproduce the problem is

    //----------------------------------------------------------------------------
    /// @file doxytestnamespace.cc
    /// @brief minimal doxygen test file to reproduce namespace errors
    //
    
    /*! \namespace NAMESPACETEST
        \brief sample namespace test
    
        Sample namespace test
    */
    
    namespace NAMESPACETEST {
      const double SAMPLE_VAR=48.12;   ///< sample variable in namespace
    
      typedef  enum { ENUM1,  ENUM2 } T_SAMPLE_ENUM; ///< sample namespace enum
    
    
      /*! 
          sample namespace function
        \param invar        variable passed to sample function
      */
    
      unsigned int SampleNamespaceFunction(unsigned int invar) {
        return invar ;
        }   
    };
    
    int main(int argc, char **argv)
    {
      return 0;
    }
    

    From this source doxygen creates a Latex file which contains duplicate labels - the elements from the namespace appear twice, once in the namespace documentation section and once in the file documentation section, and, unfortunately, they get assigned the same latex label. Consequently, I get Latex warnings like

    LaTeX Warning: Label 'namespace_n_a_m_e_s_p_a_c_e_t_e_s_t_a51ac35853accc0397365e7864258de68' multiply defined.

    and

    pdfTeX warning (ext4): destination with the same identifier (name{namespace_n_a_m_e_s_p_a_c_e_t_e_s_t_a51ac35853accc0397365e7864258de68}) has been already used, duplicate ignored

    Unfortunately, my real project generates 150 lines of such warnings which renders my compile resultspretty unreadable. Is there a way to avoid this problem? If not, is there a way to at least suppress the warnings?

     
  • Sharif yt

    Sharif yt - 2024-11-19
    Post awaiting moderation.

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.