简体   繁体   English

如何在Creator中使用我的静态Qt构建?

[英]How to use my static Qt build with Creator?

在构建Qt 5.6 msvc进行静态部署之后,我做了大约4个小时就成功构建了Qt(配置-static -platform win32-msvc2013 -nomake示例-nomake测试),然后我打开了一个新项目,但是在.pro CONFIG + =静态并切换到发布模式,并得到缺少库的错误,它的正常窗口小部件,当从发布文件夹运行exe时,其大小很小,约为20 kb,是否缺少步骤?

Don't add CONFIG += static to the project, it is not necessary. 不要将CONFIG += static添加到项目中,这是没有必要的。 The same PRO file can work with either a dynamic or static Qt build, which is convenient, since you can use the faster to compile and capable of debugging dynamic build for development, and only use the static build for final production. 相同的PRO文件可以与动态或静态Qt构建一起使用,这很方便,因为您可以使用更快的速度进行编译并可以调试动态构建以进行开发,而只能将静态构建用于最终生产。

After your static build is completed, you need to add it to a kit, and add the kit to your project: 完成静态构建后,您需要将其添加到工具箱中,并将该工具箱添加到您的项目中:

  • open Tools - Options - Build & Run 打开工具-选项-构建并运行
  • from "Qt Versions" click Add... and select your build's bin\\qmake.exe 从“ Qt版本”中单击“添加...”,然后选择构建的bin\\qmake.exe
  • from "Kits" use Add or Clone to create a new kit, select the static Qt build, the compiler and so on 从“工具包”中使用“添加”或“克隆”来创建新工具包,选择静态Qt构建,编译器等
  • from "Projects" (the wrench icon to the left of Qt Creator) - Add Kit, then select your kit 从“项目”(Qt Creator左侧的扳手图标)中-添加套件,然后选择套件
  • from the button above the Run button (the green arrow below Projects) select your kit and release 从“运行”按钮上方的按钮(“项目”下方的绿色箭头)中选择您的套件并释放

在此处输入图片说明

在此处输入图片说明

That's about it... if your build is OK your app should build and run. 就是这样...如果您的构建正常,则应构建并运行应用。

Keep in mind that if you distribute closed source applications build statically you need to provide your object files and information about the used tools and versions to satisfy the requirement of LGPL about providing an option to re-link your application against a different version of the library. 请记住,如果您以静态方式分发封闭源应用程序,则需要提供目标文件以及有关所用工具和版本的信息,以满足LGPL有关提供选项以将应用程序与其他版本的库重新链接的要求。 。 That's assuming you don't own a commercial Qt license. 假设您没有商业Qt许可证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM