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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 48
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.

BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

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

Contributor
Posts: 48
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...

BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

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?