标签:qt
这个错误在双击exe执行时不会出现,当传递命令行参数时出问题 ,解决方法:
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(rc);
//解决库路径问题============info@seatrix.com
QTextCodec *xcodec = QTextCodec::codecForLocale() ;
QString exeDir = xcodec->toUnicode( QByteArray(argv[0]) ) ;
QString BKE_CURRENT_DIR = QFileInfo(exeDir).path() ;
QStringList libpath;
libpath << BKE_CURRENT_DIR+QString::fromLocal8Bit("/plugins/platforms");
libpath << BKE_CURRENT_DIR <<BKE_CURRENT_DIR+QString::fromLocal8Bit("/plugins/imageformats");
libpath << BKE_CURRENT_DIR+QString::fromLocal8Bit("/plugins");
libpath << QApplication::libraryPaths();
QApplication::setLibraryPaths(libpath) ;
//=========================
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
标签:qt
原文地址:http://11496263.blog.51cto.com/11486263/1879351