12-13-2012 11:25 AM
My situation is I can compiler my codes without any error..
But when I try to deploy to simulator, it will show up can not find qtSql.so or qtXML.so... related issues...
I have no ideas this is a Gold version or a Break version to developers...
12-13-2012 12:00 PM
noahhuang wrote:
But when I try to deploy to simulator, it will show up can not find qtSql.so or qtXML.so... related issues...
You should not be using the pre-compiled libraries at all for the simulator. These are only for use in the release version of the app.
12-18-2012 05:02 AM
I'm having a similar problem. I tried creating a new project to pinpoint what was causing it, and it turns out everytime I try to create a singleton, I get this error message.
I tested this with a completely new project accessed from main.cpp with
Ping mainApp;
And in Ping.hpp:
class Ping : public QObject
{
Q_OBJECT
public:
Ping(QObject *parent = 0);
virtual ~Ping() {}
static Ping* instance();
private:
static Ping* appInstance;
};
Ping.cpp:
Ping::Ping(QObject *parent)
{
// create scene document from main.qml asset
// set parent to created document to ensure it exists for the whole application lifetime
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(th is);
// create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
// set created root object as a scene
Application::instance()->setScene(root);
}
Ping* Ping::instance() {
if (!appInstance) {
appInstance = new Ping();
}
return appInstance;
}
If I declare Ping* instance() and Ping* appInstance without static, it works fine. But if they are static, I get "Unable to release application on target", and the app installs correctly, but I can't open it; it quits right away.
12-18-2012 09:28 AM
if (!appInstance) {
appInstance = new Ping();
}
Why would appInstance ever be 0/false?
12-18-2012 09:33 AM
Because it's not actually created in the constructor.
Furthermore, I've removed the code inside that method except the return statement at some point and it still doesn't change anything, so long as the method is still static.
12-18-2012 09:44 AM
Variables - including pointers - are not initialised to 0 in C/C++...
12-18-2012 10:07 AM
So how would you suggest implementing a singleton if I can't check to see if the instance is already created?
12-18-2012 10:18 AM
Do you have a line in your c++ that looks like this? (Code shouldn't link without it...)
Ping * Ping::appInstance;
update it to set the variable to 0 / NULL;
Ping * Ping::appInstance(0);
yesterday