21,474
社区成员
发帖
与我相关
我的任务
分享
int main(int argc, char *argv[])
{
#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif
Q_INIT_RESOURCE(images);
QTranslator oTranslator;
oTranslator.load(":/qt_zh_CN");
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
也没有什么特别的地方
在QCoreApplication.cpp里有个函数检查报出来的
如下
bool QCoreApplicationPrivate::checkInstance(const char *function)
{
bool b = (QCoreApplication::self != 0);
if (!b)
qWarning("QApplication::%s: Please instantiate the QApplication object first", function);
return b;
}
程序里确实使用了很多applicationDirPath(),唯有一个类使用时报这个,把那个类注释掉就不报了,什么意思呢,我是在主窗体的TimerEvent里初始化的那个类。总不能给个Debug版本让别人用吧。
那个类只是有cpp上引用 了#include <QCoreApplication> 后面使用了许多QCoreApplication:: applicationDirPath()
这个用法没什么错呀,怎么解决呢