Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
like mention above!
For many reasons , we just to simple declare some classes rather include total interface header file in the main .h file(if that's not acquired,e.g that class instance as the class member etc).

we all know,To just declare a class is simple. just
C++
"class xml_document"


but while the class xml_document is reside namespace pugi.

How can I accomplish it?
I have trie :
C++
namespace pugi;
class pugi::xml_document;
pugi::xml_document & getXmlDoc()const; 


but compiler compain about the first line. thanks
Posted

Your syntax is not correct, you need to use block identifiers at the beginning and end of the class and the namespace, like:
C++
namespace pugi // start namespace definition
{
    class xml_document // start class definition
    {
        xml_document& getXmlDoc()const;

    } // end of class definition

} // end of namespace definition
 
Share this answer
 
Remove the semicolon:
C++
namespace SomeLib
   {
   class String { ... };
   }

See here: http://msdn.microsoft.com/en-us/library/5cb46ksf.aspx[^]
 
Share this answer
 
I have find the answer! thanks any way!

http://www.devx.com/tips/Tip/32118
 
Share this answer
 
Comments
Legor 28-Oct-14 6:46am    
Thats what the above solutions told you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900