[flext] unknown errors
alessandro mason
mason.alessandro.pec at gmail.com
Sun May 15 09:22:48 CEST 2011
hi,
I'm trying to compiling this code:
"class PDFP : public flext_base{
FLEXT_HEADER_TS(PDFP,flext_base,setup)
QString filename;
float pages, pageNum;
PDFP(){
//define inlets
AddInAnything("Require a PDF Document");
AddInSymbol("PDF");// A symbol for pdf file name
AddInInt(1);// Number of page to display
//define outlets
AddOutSymbol("Reading"); //A string name of image to display
AddOutInt(1); // The number of pages of the document
}
void m_read(t_symbol* s){
post("loading %s", GetString(s));
std::string file=GetString(s);// conver the symbol to a string
Poppler::Document*
document=Poppler::Document::load(QString::fromStdString(file));
if (!document || document->isLocked()) {
post("error while loading the document. Please check.");
delete document;
}
pages=document->numPages();
ToOutInt(1,pages);// send to outlet 1 the number of pages of the
loaded document
// Access page of the PDF file
Poppler::Page* pdfPage = document->page(pageNum); // Document
starts at page 0
if (pdfPage == 0) {
post("error while reading the %i page", pageNum);
}
// Generate a QImage of the rendered page
QImage image = pdfPage->renderToImage(72,72,-1,1,4,4);
if( system(" mkdir .tmp" ))
{
system( "cd .tmp" );
}else{
post("internal error while creating a folder");
}
filename.fromStdString("page.PNG");
image.save(filename,"PNG");//savepage
const char* cstr = new char['p','a','g','e','.','P','N','G'];
static const t_symbol *o= MakeSymbol(cstr);
ToOutSymbol(0,o);
delete pdfPage;
}
void m_int(int i)
{
system( "page.PNG" );
pageNum= i;// numer of pages of the document
}
static void setup(t_classid c)
{
//register methods
FLEXT_CADDMETHOD(c,0,m_read);
FLEXT_CADDMETHOD(c,0,m_int);
}
FLEXT_CALLBACK_1(m_read,t_symbol*); //callback wrappers
FLEXT_CALLBACK_I(m_int);
};
FLEXT_NEW("PDFP",PDFP) // set up PDFP"
and when I compile occours errors:
../../../flext/source/flmap.h|252|error: expected unqualified-id before ‘[’
token|
../../../flext/source/flmap.h||In constructor ‘TablePtrMap<K, T,
N>::TablePtrMap()’:|
../../../flext/source/flmap.h|202|error: expected primary-expression before
‘)’ token|
../../../flext/source/flmap.h||In constructor ‘TablePtrMap<K, T,
N>::TablePtrMap(TableAnyMap*)’:|
../../../flext/source/flmap.h|246|error: expected primary-expression before
‘)’ token|
that I don't know the meaning.
Can anyone help me pelase?
thanks
Mason Alessandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://grrrr.org/pipermail/flext/attachments/20110515/4855772d/attachment.htm>
More information about the flext
mailing list