htmltidy - whats wrong with this c++ html tidy program -


i have compiled c tidy program getting error , example program given them

#include "tidy/tidy.h" #include <stdio.h> #include <errno.h>   int main(int argc, char **argv ) {   const char* input = "<title>foo</title><p>foo!";   tidybuffer output = {0};   tidybuffer errbuf = {0};   int rc = -1;   bool ok;    tidydoc tdoc = tidycreate();                     // initialize "document"   printf( "tidying:\t%s\n", input );    ok = tidyoptsetbool( tdoc, tidyxhtmlout, yes );  // convert xhtml   if ( ok )     rc = tidyseterrorbuffer( tdoc, &errbuf );      // capture diagnostics   if ( rc >= 0 )     rc = tidyparsestring( tdoc, input );           // parse input   if ( rc >= 0 )     rc = tidycleanandrepair( tdoc );               // tidy up!   if ( rc >= 0 )     rc = tidyrundiagnostics( tdoc );               // kvetch   if ( rc > 1 )                                    // if error, force output.     rc = ( tidyoptsetbool(tdoc, tidyforceoutput, yes) ? rc : -1 );   if ( rc >= 0 )     rc = tidysavebuffer( tdoc, &output );          // pretty print    if ( rc >= 0 )   {     if ( rc > 0 )       printf( "\ndiagnostics:\n\n%s", errbuf.bp );     printf( "\nand here result:\n\n%s", output.bp );   }   else     printf( "a severe error (%d) occurred.\n", rc );    tidybuffree( &output );   tidybuffree( &errbuf );   tidyrelease( tdoc );   return rc; } 

error

build of configuration debug project cr **

make

building file: ../src/a.cpp invoking: gcc c++ compiler g++ -o0 -g3 -wall -c -fmessage-length=0 -mmd -mp -mf"src/a.d" -mt"src/a.d" -o"src/a.o" "../src/a.cpp" ../src/a.cpp: in function ‘int main(int, char**)’: ../src/a.cpp:9: error: variable ‘tidybuffer output’ has initializer incomplete type ../src/a.cpp:10: error: variable ‘tidybuffer errbuf’ has initializer incomplete type ../src/a.cpp:40: error: ‘tidybuffree’ not declared in scope make: *** [src/a.o] error 1 

the tidybuffer struct declared in tidy library header buffio.h, if include should work.

includes @ top should this:

#include <tidy.h> #include <buffio.h> #include <errno.h> 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -