12-30-2012 07:56 AM - edited 12-30-2012 09:00 AM
Hello...
Suddenly the compiler decided that my class was doing something wrong and I get this error:
'QObject::QObject(const QObject&)' is private [a lot of random stuff completely useless] within this context
This is the code:
#include <limits.h>
#include <QObject>
#include <bb/data/DataSource>
#include <bb/data/SqlDataAccess>
#include <bb/data/SqlConnection>
class DataAdapter : public QObject
{
private:
Q_OBJECT;
//MyStuff
public:
DataAdapter(QObject *parent) : QObject(parent)
{
QString filename = QDir::homePath() + "/IniTr.db";
QFile CheckFile(filename);
if(!CheckFile.exists())
{
DBFile = filename;
qDebug() << "Failed to load database, file does not exist.";
}
}
virtual ~DataAdapter()
{
//MyMemoryManagement
}
};As you can see this is exactly like many samples do: passing the parent QObject pointer to QObject constructor...
That error usually happens when you are calling the private copy constructor, but this is clearly not the case... I don't know what's wrong...
It appeared after I compiled it, run a couple of time (without using my class) then the error showed up when I linked it to the process.
[Update]
I removed a definition inside my main.cpp used to enable javascript debug as described here:
https://developer.blackberry.com/cascades/document
Now the error changed to: undefined reference to `vtable for DataAdapter'
I don't understand... I'v also put that debug lines back and the error didn't change...
I cleaned the project countless times, inside the .moc file there is not trace of my DataAdapter class... From what I understand, there should be something since it derives QObject.
12-31-2012 04:52 PM - edited 12-31-2012 04:54 PM
would you mind telling us which line throws the error?
I just cut & paste your class definition into one of my projects and it compiled fine.
I even instantiated it without issue:
int main(int argc, char **argv)
{
Application app(argc, argv);
new DataAdapter(&app);
// initialize camera app
new HelloCameraApp(&app);
return app.exec();
}
12-31-2012 07:11 PM
I don't think it's within the code... I think is a strange misconfiguration of QT...
01-01-2013 04:19 AM
can you post how you are instantiating the class? or which line is throwing the error?