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[])
{
Manager w;
w.show();
return a.exec();
}
#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();
}
To copy to clipboard, switch view to plain text mode
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!!
Bookmarks