[英]Creating windwows Qt app that does not launch cmd window
I've a cross platform app (it's a basic ellipsoid drawing example using Qt).It compiles and I can execute it form a command prompt. 我有一个跨平台应用程序 (它是使用Qt的基本椭圆体绘图示例)。它编译并且我可以从命令提示符执行它。 For linux I know how to create a .desktop file so I can launch the app that does not show a terminal when it is launched.
对于linux,我知道如何创建一个.desktop文件,这样我就可以在启动时启动不显示终端的应用程序。 However on windows, when I double click on the exe file in the explorer, it does not only luanches the Qt gui that I coded, but also a cmd window.
但是在Windows上,当我双击浏览器中的exe文件时,它不仅会关闭我编码的Qt gui,还会关闭cmd窗口。 Is there a way in windows to prevent the application to open this cmd window when I dobule click it on the explorer?
当我在资源管理器上点击它时,是否有一种方法可以阻止应用程序打开此cmd窗口?
In windows I set up the project using cmake-gui and then I open the generated visual studio solution and compile it using microsoft visual studio 2019 在Windows中我使用cmake-gui设置项目,然后打开生成的visual studio解决方案并使用microsoft visual studio 2019进行编译
I've solved this issue with this previous post hint. 我用之前的帖子提示解决了这个问题。 I added some lines in my final cpp file where the main is created has been modified to:
我在我的最终cpp文件中添加了一些行,其中创建的main已被修改为:
//... all includes and other things previous to main function
#ifdef _WIN32
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
#endif
int main(int argc, char** argv)
{//... rest of code
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.