- From: Alejo Vinjoy <avinjoy@yahoo.com.ar>
- Date: Mon, 15 Sep 2008 05:05:33 -0700 (PDT)
- To: html-tidy@w3.org
- Message-ID: <497609.19487.qm@web50710.mail.re2.yahoo.com>
Thanks so much for the help Arnaud it compiled perfectly, but when I ran it said: avinjoy@localhost:~/workspace/tidyPrueba$ g++ -g -Wall -I/usr/local/include main.cpp -L/usr/local/lib -ltidy -oparser avinjoy@localhost:~/workspace/tidyPrueba$ ./parser ./parser: symbol lookup error: ./parser: undefined symbol: tidyNodeGetValue It would seem that all the other functions are define (I tried with tidyNodeGetText and it worked fine) but not this one. /usr/local/lib is the directory where the tidylib is installed using gnuauto. The code I'm using is basically the same as the example in the web page with a few things modified: void dumpNode( TidyNode tnod, int indent, TidyDoc tdoc ,TidyBuffer *output ) { TidyNode child; Bool interesa; for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) ) { ctmbstr name; switch ( tidyNodeGetType(child) ) { case TidyNode_Root: name = "Root"; break; case TidyNode_DocType: name = "DOCTYPE"; break; case TidyNode_ProcIns: name = "Processing Instruction"; break; case TidyNode_Text: name = "Text"; break; case TidyNode_CDATA: name = "CDATA"; break; case TidyNode_Section: name = "XML Section"; break; case TidyNode_Asp: name = "ASP"; break; case TidyNode_Jste: name = "JSTE"; break; case TidyNode_Php: name = "PHP"; break; case TidyNode_XmlDecl: name = "XML Declaration"; break; case TidyNode_Start: case TidyNode_End: case TidyNode_StartEnd: default: { if ((tidyNodeGetType(child) == TidyNode_Comment) || tidyNodeIsADDRESS(child) || tidyNodeIsAPPLET(child) || tidyNodeIsBASE(child) || tidyNodeIsBASEFONT(child) || tidyNodeIsCAPTION(child) || tidyNodeIsCOL(child) || tidyNodeIsCOLGROUP(child) || tidyNodeIsDD(child) || tidyNodeIsDIR(child) || tidyNodeIsDL(child) || tidyNodeIsEMBED(child) || tidyNodeIsEM(child) || tidyNodeIsFRAME(child) || tidyNodeIsFRAMESET(child) || tidyNodeIsIMG(child) || tidyNodeIsISINDEX(child) || tidyNodeIsLINK(child) || tidyNodeIsLAYER(child) || tidyNodeIsLISTING(child) || tidyNodeIsMAP(child) || tidyNodeIsMARQUEE(child) || tidyNodeIsMENU(child) || tidyNodeIsMETA(child) || tidyNodeIsNOBR(child) || tidyNodeIsNOFRAMES(child) || tidyNodeIsNOSCRIPT(child) || tidyNodeIsOBJECT(child) || tidyNodeIsOL(child) || tidyNodeIsOPTGROUP(child) || tidyNodeIsPARAM(child) || tidyNodeIsPRE(child) || tidyNodeIsProp(tdoc,child) || tidyNodeIsQ(child) || tidyNodeIsS(child) || tidyNodeIsSCRIPT(child) || tidyNodeIsSELECT(child) || tidyNodeIsSTYLE(child) || tidyNodeIsSPACER(child) || tidyNodeIsTABLE(child) || tidyNodeIsTR(child) || tidyNodeIsWBR(child) || tidyNodeIsXMP(child) ) { tidyBufClear(output); continue; } else{ //name = tidyNodeGetName( child ); interesa=(Bool)1; } } } if (interesa) { //assert( name != NULL ); //printf( "\%*.*sNode: \%s\n", indent, indent, " ", name ); tidyBufClear(output); tidyNodeGetValue(tdoc,child,output); std::cout << "Value: " << output->bp <<std::endl; } dumpNode( child, indent + 4,tdoc, output); } } void dumpBody( TidyDoc tdoc, TidyBuffer *output ) { dumpNode( tidyGetBody(tdoc), 0, tdoc, output ); } An this fucntion gets called from the main function in the same file TidyBuffer output; TidyBuffer errbuf; int rc = -1; Bool ok; tidyBufInit(&output); tidyBufInit(&errbuf); TidyDoc tdoc = tidyCreate(); ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); // Convert to XHTML if ( ok ) rc = tidySetErrorBuffer( tdoc, &errbuf ); // Capture diagnostics if ( rc >= 0 ) rc = tidyParseFile(tdoc, "ejemplo.htm"); // Parse the input if ( rc >= 0 ) rc = tidyCleanAndRepair( tdoc ); // Tidy it up! if ( rc >= 0 ) //rc = tidyRunDiagnostics( tdoc ); dumpBody(tdoc, &output); tidyBufFree(&output); tidyBufFree(&errbuf); tidyRelease(tdoc); return rc; } Could it be a bug in the installation? Thanks so much, in advance Alejo --- El lun 15-sep-08, Arnaud Desitter <arnaud02@users.sourceforge.net> escribió: De: Arnaud Desitter <arnaud02@users.sourceforge.net> Asunto: Re: Linkage problem with C++ Para: avinjoy@yahoo.com.ar Cc: html-tidy@w3.org Fecha: lunes, 15 de septiembre de 2008, 6:26 am 2008/9/14 Alejo Vinjoy <avinjoy@yahoo.com.ar>: > Hi, I downloaded and installed Html tidy from sourceforge CVS. > I followed the instructions and installed it using autotools in gnuauto > directory and it installed correctly. > I verified that the libraries are in /usr/local/lib directory. > When I' trying to compile and link a little program I made using this line > g++ -g -Wall -otidys main.cpp -L ./usr/local/lib Use: g++ -g -Wall -I/usr/local/include main.cpp -L/path/to/tidy/lib -ltidy Regards, > > I get these error messages: > /home/loc/workspace/tidyReloaded/main.cpp:33: undefined reference to > `tidyNodeGetType' > /home/loc/workspace/tidyReloaded/main.cpp:33: undefined reference to > `tidyNodeIsADDRESS' > /home/loc/workspace/tidyReloaded/main.cpp:33: undefined reference to > `tidyNodeIsAPPLET' > > and so on.. > > Obviously I'm doing something wrong, could anyone point mein the right > direction? > Is this g++ -g -Wall -otidys main.cpp -L ./usr/local/lib correct for > compilation? > > Thanks, > Alejo > > > > ________________________________ > Yahoo! Cocina > Recetas prácticas y comida saludable > Visitá http://ar.mujer.yahoo.com/cocina/
Received on Monday, 15 September 2008 12:06:17 UTC