sophister
15th June 2009, 03:45
Hi, I am confused by this problem. When I run my application, a Runtime Error occurs. The following is my main.cpp
#include "userDB.h"
#include "manager.h"
#include "user.h"
#include <QApplication>
#include <QTextCodec>
#include <QPixmap>
UserDB users; //所有已经注册的用户
User currentUser; //当前用户
QPixmap noDishImage; //comment this line, it works fine
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName ("GB2312"));
Manager w;
w.show();
return a.exec();
}
User and UserDB are two classes I write.
Why declaring global variables of my own classes the application works fine, while declaring a blobal variable of the QPixmap leads the application to crash??
Any ideas appreciated!!
#include "userDB.h"
#include "manager.h"
#include "user.h"
#include <QApplication>
#include <QTextCodec>
#include <QPixmap>
UserDB users; //所有已经注册的用户
User currentUser; //当前用户
QPixmap noDishImage; //comment this line, it works fine
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName ("GB2312"));
Manager w;
w.show();
return a.exec();
}
User and UserDB are two classes I write.
Why declaring global variables of my own classes the application works fine, while declaring a blobal variable of the QPixmap leads the application to crash??
Any ideas appreciated!!