TiXmlComment txcComment(); is a function prototype, declaring a function called txcComment that takes no parameters and returns a TiXmlComment. What you really wanted was:
TiXmlComment txcComment;
You don't need the new constructor.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. I try to change value of the comment after his creation:
TiXmlComment txcComment();
txcComment.SetValue("Comment");
error C2228: left of '.SetValue' must have class/struct/union type
2. I try to add the comment in the document:
TiXmlDocument txdDocument("test.xml");
TiXmlComment txcComment();
txdDocument.InsertEndChild(txcComment);
error C2264: 'TiXmlNode::InsertEndChild' : cannot convert parameter 1 from 'TiXmlComment (void)' to 'const TiXmlNode &'
If to add the TiXmlComment constructor with parameter
(in tinyxml.h)
TiXmlComment (const char * in_value);
(in tinyxml.cpp)
TiXmlComment::TiXmlComment (const char * _value) : TiXmlNode( TiXmlNode::COMMENT )
{
value = _value;
}
and to use a call
TiXmlComment txcComment("Comment");
txdDocument.InsertEndChild(txcComment);
all becomes good.
It really errors?
There are errors, but you've made them! :)
TiXmlComment txcComment(); is a function prototype, declaring a function called txcComment that takes no parameters and returns a TiXmlComment. What you really wanted was:
TiXmlComment txcComment;
You don't need the new constructor.