[英]Qt , how to create QApplication without argc and argv
Hey so I need to export a qt application as a.dll and, so I dont want any arguments like argc
and argv
, but QApplication
needs them, so i tried this嘿,所以我需要将 qt 应用程序导出为 a.dll ,所以我不想要任何 arguments 像
argc
和argv
,但是QApplication
需要它们,所以
int main()
{
int c=1;
char** v = (char**)("ApplicationName");
QApplication app(c,v);
MainWindow window;
window.show();
return app.exec();
}
but I get segfault from QtCore
... Can someone help me bypass the segfault and create the QApplication
without needing argc
and argv
?但我从
QtCore
得到 segfault ... 有人可以帮我绕过 segfault 并创建QApplication
而不需要argc
和argv
吗? This didnt solve the problem cause it needs argv defined... QApplication app(argc, argv)这没有解决问题,因为它需要定义 argv... QApplication app(argc, argv)
Try this:尝试这个:
int main()
{
char* args[] = { (char*)"AppName" };
QApplication app(1,args);
MainWindow window;
window.show();
return app.exec();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.