解决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了,已经在我的机子上验证,祝大家好运!
平台: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了,已经在我的机子上验证,祝大家好运!
相关文章推荐
- “collect2: error: ld returned 1 exit status”问题解决!
- 关于collect2: error: ld returned 1 exit status 问题的解决方法
- linux下运行Qt出现cannot find -lGL和collect2: ld returned 1 exit status解决方法
- 关于Qt交叉编译过程中出现的collect2: ld returned 1 exit status问题的解决方案
- ubantu下QT开发不能编译报collect2: ld returned 1 exit status的解决
- centos7.1 QT5编译出现:cannot find -lGL 和 collect2:error:ld returned 1 exit status 错误
- Qt Creator 的 error: collect2: ld returned 1 exit status 问题
- /usr/bin/ld: 找不到 -lz collect2: error: ld returned 1 exit status
- QT出现“collect2 ld returned 1 exit status”问题原因及解决方法
- Arduino上“Collect2.exe: error: ld returned 5 exit status”错误的解决方法
- Qt Creator 的 error: collect2: ld returned 1 exit status 问题
- Qt Creator 的 error: collect2: ld returned 1 exit status 问题
- GCC 中 undefined reference to ‘ceil’ collect2:ld returned 1 exit status 错误
- 提示collect2: ld returned 1 exit status
- Ubuntu15.04 QT5编译出现cannot find -lGL 和 collect2:error:ld returned 1 exit status 错误
- 使用gcc编译时错误提示: ld returned 1 exit status问题
- linux下Qt问题cannot find -lGL collect2: error: ld returned 1 exit status
- Qt collect2: ld returned 1 exit status问题
- cocos2dx向android平台移植出现问题undefined reference to 'sqlite3_close' collect2: ld returned 1 exit status
- undefined reference to `pthread_create' collect2: ld returned 1 exit status