The two constructors are declared in content.h:

content(void);
content(string ident);

and defined in content.cpp:

content::content(void){
}

content::content(string ident){
    id = ident;
}

Then, in contents_manager.cpp:

content contents_manager::get_content(string id){
    content c;

    for(int i=0;  i<size; i++){
        c = contents_list.at(i); // contents_list is a vector<content>
        if(c.id == id)
            return c;
    }
    return NULL;
}

The only thing I think can cause this is the line in red, according to what
is said here
<http://msdn2.microsoft.com/en-us/library/c6kkh778%28VS.80%29.aspx>vector.at(i)
returns a reference so, why can't I do this? Compiling there is no error...

I don't know if what is happening has anything to do with Xerces or is only
because my C++ programing "knowledge"...sorry.

2007/11/29, Alberto Massari <[EMAIL PROTECTED]>:
>
> Javier Gálvez Guerrero wrote:
> > I have just created my main method. I am creating the "parser" class in
> my
> > project, so this is not the final project yet. I create a class and test
> it
> > with a corresponding main when I have compiled without errors (well,
> with
> > the only one that there is no main). Now there are 8 errors (with the
> main
> > defined).
> >
> > See the quoted text, please.
> >
> > 2007/11/29, Alberto Massari <[EMAIL PROTECTED]>:
> >
> >> [...]
> >>> Ventana Resultados
> >>>
> >>> Vinculando...
> >>> contents_manager.obj : warning LNK4248: símbolo (token) de typeref sin
> >>> resolver (01000019) para 'xercesc_2_8.XMLValidator'; no se puede
> >>> ejecutar la imagen
> >>> contents_manager.obj : warning LNK4248: símbolo (token) de typeref sin
> >>> resolver (0100001A) para 'xercesc_2_8.XMLGrammarPool'; no se puede
> >>> ejecutar la imagen
> >>>
> >> I guess you meant writing xercesc_2_8::XMLGrammarPool (i.e. "::"
> instead
> >> of ".")
> >>
> > I have only copied what the Visual C++ 2005 has given as an output when
> > compiling the project. It appears xercesc_2.8.XMLGrammarPool, dot and
> not a
> > colon. Actually, I have not used this on my project. I've only created a
> > parser and worked with the DOMNode API:
> >
> >
> In this case it could be caused by the various "using namespace"
> directives, that under /clr have a different separator. I think the only
> way you have to fix this is by removing the XERCES_CPP_NAMESPACE_USE and
> add a XERCES_CPP_NAMESPACE_QUALIFIER before any Xerces class (like in
> XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::Initialize(); )
> > // contents_manager.cpp
> >
> > #include "../include/gincludes.h"
> > #include "contents_manager.h"
> >
> > //...
> >
> > void contents_manager::load_guide(string xml_path){
> >
> >     XMLPlatformUtils::Initialize();
> >     XercesDOMParser* parser = new XercesDOMParser();
> >
> >     parser->parse(xml_path.c_str());
> >     DOMNode* root = parser->getDocument();
> >     DOMNode* child_aux1, *child_aux2, *child_aux3, *child_aux4,
> *child_aux5,
> > *child_aux6, *child_aux7;
> >
> >     // Check that the XML file defines the content guide
> >     if(XMLString::transcode(root->getNodeName()) == "contents"){
> >
> Beware, this test is wrong; transcode returns a pointer, so you are
> comparing two pointers, and not two strings. Either use strcmp, or
> XMLString::equals, or build two std::string objects. And don't forget to
> call XMLString::release on the pointer returned by transcode, or you'll
> leak memory.
> >         for(child_aux1 = root->getFirstChild(); child_aux1 != NULL;
> > child_aux1 = child_aux1->getNextSibling()){
> >             char* child1_name =
> > XMLString::transcode(child_aux1->getNodeName());
> > //...
> >
> >     delete parser;
> >
> >     XMLPlatformUtils::Terminate();
> > }
> >
> > That is the only I have done in my class regarding Xerces. In the header
> > file I have included these:
> >
> >
> > //contents_manager.h
> >
> > #include "../include/gincludes.h"
> > #include "../content/content.h"
> > #include <xercesc/dom/DOM.hpp>
> > #include <xercesc/dom/DOMImplementation.hpp>
> > #include <xercesc/dom/DOMImplementationLS.hpp>
> > #include <xercesc/dom/DOMWriter.hpp>
> > #include <xercesc/util/PlatformUtils.hpp>
> > #include <xercesc/parsers/XercesDOMParser.hpp>
> > #include <xercesc/dom/DOM.hpp>
> > #include <xercesc/sax/HandlerBase.hpp>
> > #include <xercesc/util/XMLString.hpp>
> > #include <xercesc/util/PlatformUtils.hpp>
> >
> > using namespace System;
> > using namespace System::Runtime::InteropServices;
> > using namespace std;
> >
> > XERCES_CPP_NAMESPACE_USE
> >
> > class contents_manager {
> > //...
> >
> >
> > So that's all.
> >
> Sorry, I extracted the wrong symbol from the spanish description: it
> complains that contents_manager::get_content is using two constructors
> for the "content" class that cannot be
> found,content::content(std::string) and content::content(void). Double
> check if you have implemented them, or just declared in the header file.
>
> Alberto
>

Reply via email to