简体   繁体   中英

How can I make the program I wrote with QT4 execute when I launch it not from IDE?

When I run the program from IDE (VS2008) it works perfectly. When I want to launch it from Windows Commander it doesn't work because it needs DLL that wasn't found. Used both debug and release builds.

Make sure the Qt DLL's are in your PATH . Two simple solutions are:

  • Copy Qt's DLL's to your EXE 's directory.
  • Copy Qt's DLL's to %WINDOWS%\\System32 (eg C:\\WINDOWS\\System32 ) ( possibly unsafe, especially if you install another versions of Qt system-wide . Also, requires administrative privilages).

You should make sure that the DLLs needed by the executable (probably QT Dlls) are in the PATH or in the same directory as the executable. You can find which dlls are needed by using depends.exe

另一个解决方案是在VS工具->选项->项目和解决方案-> VC ++目录中放置qt bin子目录的路径。

You could link it statically with all the libraries it needs. Saves messing around with DLLs and stuff. On the down side, you can't update DLLs on your installed PCs to get updated/improved/fixed functionality, and will need to rebuild and redeploy.

So whether or not this is viable depends on what your installation targets are - a few PCs controlled by you, or every man+dog who decides to download your program?

Statically compiling in a library bug (security hole for example) and shipping that to your clients would be very poor form. Doing the same on a secure corporate intranet may make it worth doing just so that you know that each install is running exactly the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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