standalone exe in Qt

有些话、适合烂在心里 提交于 2020-01-05 04:14:17

问题


I want to make a standalone .exe file in Qt msvc 2010 5. I change the mode to "release" and build my project and I copy the .exe file in release/debug folder to bin directory in Qt directory and then I copy all the bin folder. it works properly in my computer, but when I move the bin folder to other computers the .exe file doesn't work. I installed visual c++ 2010 redistributable package in the other computer but still it doesn't work. what should I do?


回答1:


The answer is most likely that the other machine doesn't have Qt installed. If you want a wholly standalone Qt app on Windows (statically linked), check this out: http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows

Some quick build instructions -

  1. Make sure you have python installed and in your path Get the Qt source code (http://download.qt-project.org/official_releases/qt/5.1/5.1.1/single/qt-everywhere-opensource-src-5.1.1.zip)
  2. unzip the zip file and open a Visual Studio command prompt in that directory
  3. execute configure -static -release -no-audio-backend -opengl desktop -opensource -confirm-license
  4. execute nmake (this will compile all of Qt and will take a while depending on your processing power)
  5. add CONFIG+=static to your .pro file call qmake from the build of qt you just made and then run nmake on your project. You'll then get a statically linked binary. You'll know because even a very small program will be > 5MB in size.


来源:https://stackoverflow.com/questions/19077599/standalone-exe-in-qt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!