Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
II_ARROWS
Posts: 43
Registered: ‎03-02-2012
My Device: Torch 9810
My Carrier: Vodafone

Compiler suddenly thinks I'm passing a pointer by value...

[ Edited ]

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/documentation/getting_started/tools/debugging.html

 

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.

Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 660
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: Compiler suddenly thinks I'm passing a pointer by value...

[ Edited ]

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();
}

Please use plain text.
Contributor
II_ARROWS
Posts: 43
Registered: ‎03-02-2012
My Device: Torch 9810
My Carrier: Vodafone

Re: Compiler suddenly thinks I'm passing a pointer by value...

I don't think it's within the code... I think is a strange misconfiguration of QT...

Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 660
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: Compiler suddenly thinks I'm passing a pointer by value...

can you post how you are instantiating the class?  or which line is throwing the error?

 

Please use plain text.