[SOLVED] 'source' was not declared in this scope
-
hello everyone! I'm building a class to facilitate me in the use of XML.
this->type and this->files are properly valorized, but compiling read the following error:
[code]
/home/mezzo/Qt/test/mainwindow.cpp:34: error: 'source' was not declared in this scope
QXmlStreamReader xml(source);
^
[/code]
I am new to the C ++, but in this case I understand the error but do not know how to solve it. you have ideas?
thank you.[code]
if(this->type==1){
QFile* source=this->file;
}
if(this->type==0){
QString source=this->code;
}
QXmlStreamReader xml(source);
[/code] -
Hi,
Are you comming from python ?
From the top of my head:
@
QXmlStreamReader xml;
if(this->type==1){
xml.setDevice(this->file);
}
if(this->type==0){
xml.addData(this->code);
}
@Hope it helps
-
aaaaaa perfect!
thank you very much.
yes, I also come from the python, are oriented more towards the web languages php, javascript etc ... -
You're welcome !
I'd recommend getting a good book about C++, it'll save you some headaches.
Also, please update the thread tittle prepending [solved] so other forum users may know a solution has been found :)