Operating System - HP-UX
1751946 Members
4699 Online
108783 Solutions
New Discussion

Re: Unix C++ Compiler Error

 
chamcham
Occasional Collector

Unix C++ Compiler Error

Hi, I'm trying to compile a c++ program in unix environment at HPUX box via c++ Compiler, but I'm hit with below error. I'm not sure where it goes wrong as using the same file we are able to compile in Sun Solaris Environment.

 

Error:

tinyxml.h: In member function 'int TiXmlElement::AppendChild(const std::string&, const T&)':
tinyxml.h:1164: error: no matching function for call to 'TiXmlElement::InsertEndChild(TiXmlText&)'
tinyxml.h:586: note: candidates are: TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode&)

Snippet of code that's giving error:

#ifdef TIXML_USE_STLtemplate < typename T >
int AppendChild( const std::string& name, const T& value ) 
{       
    std::ostringstream  ss; 
    ss << value; 
    std::string valueStr = ss.str(); 

    TiXmlText textNode = (valueStr.c_str()); 
    TiXmlElement  childElement  = (name.c_str()); 

    childElement.InsertEndChild(textNode);
    this->InsertEndChild(childElement); 

    return TIXML_SUCCESS; 
}
#endif

I use this command to compile the file : gmake -f xml.mk

Any idea where it goes wrong?

Appreciate your help on this.

2 REPLIES 2
Steven Schweda
Honored Contributor

Re: Unix C++ Compiler Error

> [...] a c++ program [...]

   Some open-source thing, or your own code, or what?

> [...] HPUX box [...]

      uname -a

   I know approximately nothing about C++, but if I had a question like
this, then I might reveal the compiler/version being used, and probably
what's on lines 586 and 1164 of tinyxml.h.

> I use this command to compile the file : gmake -f xml.mk

   Of what use is that?  What's the actual compile command?

chamcham
Occasional Collector

Re: Unix C++ Compiler Error

> Some open-source thing, or your own code, or what?

      yes it's an open source code, but we added this function.

> uname -a

   HP-UX  B.11.31 U ia64 0993361822 unlimited-user license

>    I know approximately nothing about C++, but if I had a question like
this, then I might reveal the compiler/version being used, and probably
what's on lines 586 and 1164 of tinyxml.h.

 we're using gcc version 4.2.3 to compile.

Please refer to comment for line number 586 and 1164.

TiXmlNode* InsertEndChild(const TiXmlNode& addThis ); // here's line 586
#ifdef TIXML_USE_STLtemplate < typename T >
int AppendChild( const std::string& name, const T& value ) 
{       
    std::ostringstream  ss; 
    ss << value; 
    std::string valueStr = ss.str(); 

    TiXmlText textNode = (valueStr.c_str()); 
    TiXmlElement  childElement  = (name.c_str()); 

    childElement.InsertEndChild(textNode); //here's line 1164
    this->InsertEndChild(childElement); 

    return TIXML_SUCCESS; 
}
#endif 

 

> Of what use is that?  What's the actual compile command?

       we use this command to compile the make file. We have few libraries needed to be recompiled in HP-UX as previously those files were compiled in  Sun Solaris. After compiling the make file, then only we'll compile the main program using the same command.