qt 找不到mingw10.dll 出错.doc_第1页
qt 找不到mingw10.dll 出错.doc_第2页
qt 找不到mingw10.dll 出错.doc_第3页
qt 找不到mingw10.dll 出错.doc_第4页
qt 找不到mingw10.dll 出错.doc_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

qt 找不到mingw10.dll 出错估计很多qt新手都会遇到这样的问题。出现这样的问题分两种情况,一种是电脑上已经安装了qt,第二种是编译好的qt程序拷贝到另外一台没有安装qt的电脑上我们先说第一种情况。这种情况绝大多数的问题出在环境变量上。你会发现用Qt Command Promtp去执行编译好的qt程序是没有问题的,但双击图标执行程序就会出错。请仔细看看刚进入Qt Command Promtp时屏幕上打印的几行字:Setting up a MinGW/Qt only environment.- QTDIR set to e:Qt2009.04qt- PATH set to e:Qt2009.04qtbin- Adding e:Qt2009.04bin to PATH- Adding C:WINDOWSSystem32 to PATH.由于qt默认是动态编译的,执行的时候需要加载动态库,而安装qt的时候并没有修改环境变量,所以它找不到某些库是很正常的。这时只要修改一下环境变量就行了。进入“控制面板”,双击“系统”,选择“高级”,单击下面有一个名为“环境变量”的按钮。如图之后选择path,单击编辑。如图最后在“变量值”一栏的最后添加上你的qt路径。例如我添加的路径为:;e:Qt2009.04qtbin (注意,路径前面的分号是必须的!)保存后你再双击编译好的qt程序就可以正常运行了。然后我们再来说说第二种情况。相信看完上文后,你便会明白为什么qt程序拷贝到其他没有安装qt的电脑上不能运行的原因。解决办法由两种,一种是直接把qt所需的动态库也拷贝过去,并设置环境变量。第二种方法是将qt的程序静态编译,就是把所需的库都编到程序里。当然这样带来的结果是程序会变得比较大。PS:随便说一下qt安装的路径,qt安装路径一定不要有空格。最初我安装qt的路径是D:Program Files.结果编译的时候出现一大堆错误,说什么到不到路径什么的。出现这种问题的朋友重新安装一遍qt吧!下面来看看mingwm10.dll的作用:MinGW的全称是Minimalistic GNU for Windows,它提供了基于GNU GCC 和其他相关程序( make、autoconf 等等)构造Win32 程序所必需的头文件和库。也许你首先会想到Cygwin。两者都是可以将Unix 下程序在Win32下编译运行的办法。但所不同的是,Cygwin中是将完整的POSIX 系统调用映射到本地API,使用一个模拟POSIX 调用的dll。因此在实际执行时的效率比不上本地编译代码。另外一点:Cygwin的License 是GPL,也就是说你在Cygwin上平台的代码必须开放。(这个是很难让人接受的,仅仅因为移植代码就要开放源码)而MinGW 与Cygwin的上述两点恰好相反,它将代码编译成Win32 本地代码,使用msvcrt.dll的C运行时库。而且MinGW的其他运行库不以GPL License保护,这也意味着你使用MinGW编译的代码不必公开源码。msvcrt.dll本身是随Win32平台发行的,因此这是一个完全免费的环境。有人会问:有Visual C+、Borland C+ 等等,为什么还要用MinGW ?第一、它们不是免费的;第二、移植Unix下的C/C+程序将十分痛苦。目前,开源社区中Unix下许许多多著名的库和程序都有了MinGW的版本(因为移植方便)。同时Win32本地 API 和其他一些库,比如DirectX 7/8/9,OpenGL都被移植到了MinGW 下,它是理想的跨平台解决方案。但经使用发现mingw编译的程序有的还需要mingwm10.dll这个dll。经搜索:mingwm10.dll是mingw的一个动态链接库,但不是C运行时库.Even when using VC+ you have to ship the C runtimes, unless you use VC+ 6 which has the same C runtime as shipped with Windows already.VolkerNOT true, because -mthreads is just needed for thread-safe exception handling. Since Qt DOES NOT use exceptions at all, you can safly remove this flag on a MinGW32-System.有-mthreads链接选项则需要这个dll。怎样静态链接进去,还没有发现。If you wish to remove the dependency on mingwm10.dll as well, here are the steps I followed.Note: there is some discussion around the forums as to whether this is a valid solution.It seems to work for me so far.Edit c:qtqt4.2.3mkspecswin32-g+qmake.conf and remove all occurrences of -mthreads.Recompile Qt as above. Compile your project and the dependency on mingwm10.dll will be no longer.I created a MT application with u+, and run it withouth mingw10.dll successfully.This is not supposed to be possible. Multithreaded applications should be built with the -mthreads option given to the compiler, which will trigger dynamic linking to mingw10.dll. It is promissed that a future version of MinGW will remove this severe inconvenience.There are long discussions about this topic on the Qt forum.That -mthreads is needed, because it makes the compiler generate thread-safe versions of some codes.It links with mingwm10.dll as the dll framework provide the only documented way a certain cleanup codecould be triggered after each thread terminates. (VC+ uses an undocumented way) So I can no longer hope that you somehow miraculosly removed the dependency on mingwm10.dll.Ok, for the benefit of Anonymous, this is how you get rid of mingwm10.dll.Edit the file $QTDIRmkspecswin32-g+qmake.conf and remove all instances of -mthreads.Then recompile your app. The mingwm10.dll is no longer a dependancyDisclaimer: No-one seems to be entirely sure what that DLL is there for.The best explanation Ive seen is that it has something to do with propagating exceptions in multithreaded programs. However, Qt doesnt use exceptions, so unless you use them yourself, it shouldnt be a problem. I havent had any problems with the DLL removed, and many others havereported smooth sailing as well. However, this could create problems if you use exceptions andthreads in your program.As far as I know mingw-compiled multithreaded applicaions should always be dynamically linked to mingwm10.dll, so this file should be available on computers running the application. It seems that U+ somehow removes this na

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论