当我不是从IDE启动时,如何使用QT4编写的程序执行?

时间:2022-07-18 20:46:51

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.

当我从IDE(VS2008)运行程序时,它运行得很好。当我想从Windows Commander启动它时,它不起作用,因为它需要找不到的DLL。使用调试和发布版本。

4 个解决方案

#1


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

确保Qt DLL在你的PATH中。两个简单的解决方案:

  • Copy Qt's DLL's to your EXE's directory.
  • 将Qt的DLL复制到EXE的目录中。

  • Copy Qt's DLL's to %WINDOWS%\System32 (e.g. C:\WINDOWS\System32) (possibly unsafe, especially if you install another versions of Qt system-wide. Also, requires administrative privilages).
  • 将Qt的DLL复制到%WINDOWS%\ System32(例如C:\ WINDOWS \ System32)(可能不安全,特别是如果您在系统范围内安装其他版本的Qt。此外,还需要管理权限)。

#2


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

您应确保可执行文件(可能是QT Dll)所需的DLL位于PATH中或与可执行文件位于同一目录中。您可以使用depends.exe找到所需的dll

#3


another solution would be to place path to qt bin subdir in VS tools->options->projects and solutions->VC++ directories.

另一个解决方案是在VS tools-> options-> projects and solutions-> VC ++目录中放置qt bin subdir的路径。

#4


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.

您可以将其与所需的所有库静态链接。节省了DLL和东西的混乱。另一方面,您无法更新已安装PC上的DLL以获取更新/改进/修复功能,并且需要重建和重新部署。

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?

因此,这是否可行取决于您的安装目标是什么 - 由您控制的几台PC,或者决定下载您的程序的每个人+狗?

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.

静态编译库错误(例如安全漏洞)并将其发送给您的客户将是非常糟糕的形式。在安全的企业内部网上执行相同操作可能会使您知道每个安装运行完全相同。

#1


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

确保Qt DLL在你的PATH中。两个简单的解决方案:

  • Copy Qt's DLL's to your EXE's directory.
  • 将Qt的DLL复制到EXE的目录中。

  • Copy Qt's DLL's to %WINDOWS%\System32 (e.g. C:\WINDOWS\System32) (possibly unsafe, especially if you install another versions of Qt system-wide. Also, requires administrative privilages).
  • 将Qt的DLL复制到%WINDOWS%\ System32(例如C:\ WINDOWS \ System32)(可能不安全,特别是如果您在系统范围内安装其他版本的Qt。此外,还需要管理权限)。

#2


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

您应确保可执行文件(可能是QT Dll)所需的DLL位于PATH中或与可执行文件位于同一目录中。您可以使用depends.exe找到所需的dll

#3


another solution would be to place path to qt bin subdir in VS tools->options->projects and solutions->VC++ directories.

另一个解决方案是在VS tools-> options-> projects and solutions-> VC ++目录中放置qt bin subdir的路径。

#4


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.

您可以将其与所需的所有库静态链接。节省了DLL和东西的混乱。另一方面,您无法更新已安装PC上的DLL以获取更新/改进/修复功能,并且需要重建和重新部署。

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?

因此,这是否可行取决于您的安装目标是什么 - 由您控制的几台PC,或者决定下载您的程序的每个人+狗?

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.

静态编译库错误(例如安全漏洞)并将其发送给您的客户将是非常糟糕的形式。在安全的企业内部网上执行相同操作可能会使您知道每个安装运行完全相同。