您的位置:首页 > 编程语言 > Qt开发

解决QT静态编译和debug库问题(mingwm10.dll丢失、collect2:ld returned 1 exit status)

2011-04-19 21:40 831 查看
通过网上到处找资料,终于搞定了遇到的问题,相信其它人也会遇到,我就把解决方法非写出来了:

平台:windows7          软件:qt4.6+qt creator 1.3     使用的安装包是  qt-sdk-win-opensource-2009.05.exe

问题描述:
     (1)使用qt creator 生成工程,写好程序进行编译运行,在qt creator点击运行,程序能跑起来,没问题,可是我在工程目录下找到编译生成的程序双击运行时,提示缺少mingwm10.dll,无法运行。
     (2) 按照 http://wiki.qtcentre.org/index.php?title=Building_static_Qt_on_Windows#MinGW 这个方法完成操作以后,使用qt creator 不能用debug,只能使用release选项,使用debug选项产生的错误提示是:collect2:ld returned 1 exit status    通过查找资料发现是缺少debug库。

解决方案:
     (1)编辑 C:/Qt/2009.05/qt/mkspecs/win32-g++/qmake.conf 文件 把 QMAKE_LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
       改为:QMAKE_LFLAGS = -static -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
     (2)在开始菜单里找到Qt Command Prompt并运行,输入命令:   configure -static -debug-and-release -no-exceptions
     (3)上一条命令运行成功后再输入命令:mingw32-make sub-src,等1 ~3 小时可能就运行完了, 完成后就ok了,已经在我的机子上验证,祝大家好运!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  qt command windows 平台 c
相关文章推荐