资源预览内容
第1页 / 共12页
第2页 / 共12页
第3页 / 共12页
第4页 / 共12页
第5页 / 共12页
第6页 / 共12页
第7页 / 共12页
第8页 / 共12页
第9页 / 共12页
第10页 / 共12页
亲,该文档总共12页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
MinGW-GCC 版本、wxWidgets 库编译安装和生成程序的 mingwm10.dll、 libgcc_s_dw2-1.dll 依赖问题解决本文编写和程序配置调试: 蔚蓝 (winland0704126.com )http:/hi.baidu.com/winland0704/home 一、MinGW 发行版维基百科:MinGW(Minimalist GNU for Windows) ,又称 Mingw32,是将 GNU 开发工具移植到 Win32平台下的产物,包括一系列头文件(Win32API ) 、库和可执行文件。 MinGW 是从 Cygwin(1.3.3 版)基础上发展而来,但是用 MinGW 使用 Windows 中的 C 运行库。因此用 MinGW 开发的程序不需要额外的第三方 DLL 支持就可以直接在 Windows 下运行,而且也不一定必须遵从 GPL 许可证。这同时造成了MinGW 开发的程序只能使用 Win32API 和跨平台的第三方库,而缺少 POSIX 支持 1,大多数 GNU 软件无法在不修改源代码的情况下用 MinGW 编译。官网:http:/www.mingw.org/ 现在已经有 MinGW-w64 - for 32 and 64 bit Windows 项目,可以为为 64 位 Windows 提供开发环境。64 位版本仍在开发中,有测试版本放出。http:/sourceforge.net/projects/mingw-w64/ 除了官方编译的 MinGW-GCC 版本,还有其他人员自己重新编译打包的发行版,本文中介绍其中的几个。1、MinGW 官方版本网址:http:/sourceforge.net/projects/mingw/ /bin 包含动态库:libgcc_s_dw2-1.dll 105KBmingwm10.dll 24KBlibstdc+-6.dll 860KBGCC 配置信息:Using built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=c:/omingw/bin/./libexec/gcc/mingw32/4.5.2/lto-wrapper.exeTarget: mingw32Configured with: ./gcc-4.5.2/configure -enable-languages=c,c+,ada,fortran,objc,obj-c+ -disable-sjlj-exceptions -with-dwarf2 -enable-shared -enable-libgomp -disable-win32-registry -enable-libstdcxx-debug -enable-version-specific-runtime-libs -disable-werror -build=mingw32 -prefix=/mingwThread model: win32gcc version 4.5.2 (GCC)2、TDM-GCC(CodeBlocks 和 CodeLite 带的)网址:http:/tdm-gcc.tdragon.net/ /bin 包含动态库:libgcc_s_sjlj-1.dll 234KBmingwm10.dll 18KBGCC 配置信息:Using built-in specs.Target: mingw32Configured with: ././gcc-4.4.1/configure -prefix=/mingw -build=mingw32 -enable-languages=c,ada,c+,fortran,objc,obj-c+ -disable-nls -disable-win32-registry -enable-libgomp -enable-cxx-flags=-fno-function-sections -fno-data-sections -disable-werror -enable-threads -disable-symvers -enable-version-specific-runtime-libs -enable-fully-dynamic-string -with-pkgversion=TDM-2 mingw32 -enable-sjlj-exceptions -with-bugurl=http:/www.tdragon.net/recentgcc/bugs.phpThread model: win32gcc version 4.4.1 (TDM-2 mingw32)3、MinGW Distro - nuwen.net 最新版本网址:http:/nuwen.net/mingw.html /bin 包含动态库:mingwm10.dll 27KBGCC 配置信息:Target: i686-pc-mingw32Configured with: ./src/configure -prefix=/c/temp/gcc/dest -enable-languages=c,c+ -with-arch=i686 -with-tune=generic -disable-libstdcxx-pch -disable-nls -disable-shared -disable-sjlj-exceptions -disable-win32-registry -enable-checking=release -disable-ltoThread model: win32gcc version 4.6.0 (GCC)4、QP-GCC 版本网址:http:/code.google.com/p/qp-gcc/ 这个和后面的 PCX 版本都是国人弄的,链接库全是静态编译的版本,很好使,编译出来的程序只需要一个 exe 就可以了。 QP 版的是 CSDN 上的 Loaden(老邓)大侠弄得:http:/topic.csdn.net/u/20100302/17/3a465a36-defa-46a3-a913-267c86673579.html /bin 包含动态库:mingwm10.dll 24KBGCC 配置信息:Using built-in specs.Target: i686-mingw32Configured with: ././src/gcc-4.4.5/configure -prefix=/mingw -host=i686-mingw32 -target=i686-mingw32 -build=i686-pc-linux-gnu -enable-languages=c,c+ -enable-static -enable-cxx-flags=-fno-function-sections -fno-data-sections -enable-fully-dynamic-string -enable-version-specific-runtime-libs -enable-threads=win32 -enable-libgomp -enable-libiconv -disable-shared -disable-nls -disable-werror -disable-libstdcxx-pch -disable-win32-registry -disable-sjlj-exceptions -with-dwarf2 -with-gmp=/home/loaden/AUR/mingw32/depends -with-mpfr=/home/loaden/AUR/mingw32/depends -with-pkgversion=QP MinGW32 -with-bugurl=http:/qp-gcc.googlecode.comThread model: win32gcc version 4.4.5 (QP MinGW32)5、PCX 版本,包括 32bit 和 64bit 版本的 MinGW网址:http:/code.google.com/p/pcxprj/ ,编译打包:xunxun1982MinGW_gcc4.5.3.20110317_static_win64.7zMinGW_gcc4.5.3.20110324_static_win32.7z项目主页还有 Code:Blocks 静态编译的打包,以及 Code:Blocks + 静态 MinGW 的合集包。未测试,应该和 QPGCC 版本差不多。这个版本已经更新到 GCC 4.6 的测试版本了。二、MinGW 生成程序的(mingwm10.dll, libgcc_s_dw2-1.dll)DLL依赖问题及解决1、各版本 MinGW 生成 helloworld 程序测试代码 main.cpp:#include #include #include using namespace std;int main(int argc, char *argv)printf(Hello World!n);coutEnvironment Variables:Environment Variables 对话框中,把 WXWIN 路径改成新的:D:wxWidgets-2.8.12并把 PATH 和 WXCFG 里的 gcc_dll 改成 gcc_lib。第二处:Settings 菜单Tags Settings:在 Tags Options 对话框里,选中左边 Include Files,把老版的 wxinclude 目录删掉,上面列表加上新的:D:wxWidgets-2.8.12include下面列表加上新的:D:wxWidgets-2.8.12includewxunivD:wxWidgets-2.8.12includewxunix然后重启 CodeLite。wxHello 对话框(就一个框,一个 OK 按钮,一个 Cancel 按钮) ,编译生成后:Debug 版本: 28MBRelease 版本:1.94MB这个 debug 版够大的, wxWidgets 大概就这样吧。这里生成的 exe 都是独立运行的,不需要 mingwm10.dll,不需要 libgcc_s_dw2-1.dll 或libgcc_s_sjlj-1.dll 。也不需要 wxWidgets 的 dll 动态库。4、wxWidgets 库编译安装(QP-GCC 编译环境)和去 DLL 依赖与上面类似:QP-MinGW 目录在:D:MinGWwx 目录在 D:wxWidgets-2.8.12设置 cmd 编译环境set PATH=D:MinGWbin;%PATH%设置 wxWidgets-2.8.12 的编译配置文件:D:wxWidgets-2.8.12buildmswconfig.gcc改为:SHARED ?= 0UNICODE ?= 1BUILD ?= debugRUNTIME_LIBS ?= dynamic编译生成 wx 静态库$ cd /d D:wxWidgets-2.8.12buildmsw$ make -f makefile.gcc编译好 debug 版静态 wx 库后,再修改 config.gcc 为SHARED ?= 0UNICODE ?= 1BUILD ?= releaseRUNTIME_LIBS ?= dynamic然后编译:$ make -f makefile.gcc等编译好后,debug 和
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号