Click to See Complete Forum and Search --> : Using managed class in unmanaged class


priyank9
December 7th, 2006, 06:15 AM
Hi, Actually I want to use managed class XmlDocument in my unmanaged class. I got error “error C3265: cannot declare a managed 'myDoc' in an unmanaged 'myClass'”. So I used gcroot to use this managed class in my unmanaged call gcroot<XmlDocument*> myDoc; But now I am getting error “error C2143: syntax error : missing ';' before '<'” and “error C2501: 'myClass::gcroot' : missing storage-class or type specifiers”. Can I know What is the problem with this?
Thanks in advance,
Priyank using

darwen
December 7th, 2006, 09:35 AM
You'll probably need to give the fully qualified name of XmlDocument, or put a "using namespace" at the top of the code :


gcroot<System::Xml::XmlDocument *> m_pXmlDocument;


Also if you 'new' your XmlDocument inside of your class you'll need to remove the #define new DEBUG_NEW from the top of the .cpp.

Darwen.