MinGW 使用 msvcr90.dll
1.MinGW 系统默认情况
/*
* We need to set a default MSVCRT_VERSION which describes the MSVCRT.DLL on
* the users system. We are defaulting to XP but we recommend the user define
* this in his config.h or Makefile file based on the minimum supported version
* of OS for his program.
* ME = 600
* XP = 710
* VISTA = 800
* WIN7 = 900
* WIN8 = 1010
*/
#ifndef MSVCRT_VERSION
#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
#define MSVCRT_VERSION 1010
#elif _WIN32_WINNT >= _WIN32_WINNT_WIN7
#define MSVCRT_VERSION 900
#elif _WIN32_WINNT >= _WIN32_WINNT_VISTA
#define MSVCRT_VERSION 800
#elif _WIN32_WINNT >= _WIN32_WINNT_WINXP
#define MSVCRT_VERSION 710
#elif _WIN32_WINNT >= _WIN32_WINNT_WIN2K
#define MSVCRT_VERSION 700
#elif _WIN32_WINNT >= _WIN32_WINNT_WINME
#define MSVCRT_VERSION 600
#else
#define MSVCRT_VERSION 700
#endif /* _WIN32_WINNT >= _WIN32_WINNT_WINME */
#endif /* ndef MSVCRT_VERSION */
2. MinGW 使用高版本 VC runtime
gcc -dumpspecs > <mingw-root>/lib/gcc/mingw32/<gcc-version>/specs
*cpp:-DMSVCRT_VERSION=0x0710 %{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} %{pthread:-D_REENTRANT} %{!no-pthread: }*libgcc:%{mthreads:-lmingwthrd} -lmingw32 %{shared-libgcc:-lgcc_s} %{!shared-libgcc:-lgcc_eh} -lgcc -lmoldname71 -lmingwex -lmsvcr71

3. 重新编译 libmingwex.a
ALL_CFLAGS=$(CFLAGS) $(INCLUDES) -DNTDDI_VERSION=0x05010000 -DMSVCRT_VERSION=800
MinGW win32api 4.0.3-1 的头文件中关于 findfirst findnext 的定义不正确,需要修改替换 wchar.h 和 io.h,点此下载
./configure
make
*libgcc:%{mthreads:-lmingwthrd} -lmingw32 %{shared-libgcc:-lgcc_s} %{!shared-libgcc:-lgcc_eh} -lgcc -lmoldname80 -lmingwex80 -lmsvcr80


<?xml version='1.0' encoding='UTF-8' standalone='yes'?><assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level='asInvoker' uiAccess='false' /> <!-- VC2008 新增,程序是否需要以管理员运行 --></requestedPrivileges></security></trustInfo><dependency><dependentAssembly><assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /></dependentAssembly></dependency></assembly>
$ gcc a.c -nostdlib -lmsvcr80 -lgccd:/msys/mingw/bin/../lib/gcc/mingw32/4.8.1/libgcc.a(__main.o):(.text+0x5a): undefined reference to `atexit'collect2.exe: error: ld returned 1 exit status
4. 嵌入manifest
#include "winuser.h"
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST msvcrt.manifest
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
</assembly>
MinGW 使用 msvcr90.dll的更多相关文章
- 让VC编译出来的程序不依赖于msvcr80.dll/msvcr90.dll/msvcr100.dll等文件
---转载:http://hi.baidu.com/liu_haitao/item/e2157ac3a3c32a0bc610b253 让VC编译出来的程序不依赖于msvcr80.dll/msvcr90 ...
- 转载: 找不到MSVCR90.dll、Debug vs Release及cppLapack相关
今天调试程序时出现了,找不到MSCVR90.dll的错误,最好查找到了解决办法,原文链接如下: http://hi.baidu.com/wpzhao/blog/item/72dc08f77ce9b ...
- 在 Windows 下用 TDM-GCC(MinGW)开发 DLL 涉及到数据同步锁及 DLL 初始化终止化函数的问题
在 Windows 下用 TDM-GCC(MinGW)开发 DLL 如果要用到数据同步锁,理论上可以采用 Windows API 提供的临界区实现(需要用到的函数有 InitializeCritica ...
- 引用MinGW生成的.dll.a后出现的问题
以前很少调用MinGW的运行时库,现在用到一个项目,用到了glib和gettext等. 遇到了一个问题,折腾了一个下午. gettext的运行时库之一是intl,MinGW只提供了.dll.a,于是参 ...
- VC 调用 MinGW 生成的dll good
首先,如果dll 中导出了C++的类,那么就不要折腾了.不同的编译器编译出来的C++代码是不保证通用的.如果dll中只是一些C 函数,那么是可以互相调用的. MinGW 生成dll时即使生成了 .a ...
- 文件转换dll mingw
MinGW:c -> o gcc -c a.cc -> exe gcc a.c libs.o -o a.exe (从主程序a.c,附加libs,生成a. ...
- MSVC vs. MinGW 之dll玩转攻略手记【转
一份粗糙的研究记录,有待补完和整理. MinGW:c -> o gcc -c a.cc -> exe gcc a.c libs.o -o a.exe ( ...
- dll = MinGW gcc 生成动态链接库 dll 的一些问题汇总
MinGW gcc 生成动态链接库 dll 的一些问题汇总 https://blog.csdn.net/liyuanbhu/article/details/42612365 网络上关于用 MinGW ...
- MinGW gcc 生成动态链接库 dll 的一些问题汇总(由浅入深,很详细)
网络上关于用 MinGW gcc 生成动态链接库的文章很多.介绍的方法也都略有不同.这次我在一个项目上刚好需要用到,所以就花了点时间将网上介绍的各种方法都实验了一遍.另外,还根据自己的理解试验了些网上 ...
随机推荐
- TF卡座(外焊、内焊、掀盖式、全塑、简易)
TF卡座(外焊.内焊.掀盖 式.全塑.简易
- codecomb 2086【滑板鞋】
题目背景 我的滑板鞋时尚时尚最时尚 回家的路上我情不自禁 摩擦 摩擦 在这光滑的地上摩擦 月光下我看到自己的身影有时很远有时很近 感到一种力量驱使我的脚步 有了滑板鞋天黑都不怕 题目描述 你在魅力之都 ...
- 结构体的sizeof
首先有几条规则: 1. 结构体的成员相对于结构体的偏移量,是该成员所包含的最大简单类型(指占用内存数)的整数倍(如果该成员本身又是一个结构体,就要递归查找其简单类型,简单类型就是char short ...
- poj 1020 Anniversary Cake(切正方形蛋糕+搜索)
...
- RIAidea – Focus on Flash/Flex/AIR » About Me
RIAidea – Focus on Flash/Flex/AIR » About Me Browse > Home > About Me Tuesday, May 20, 2014 | ...
- python语言磁力搜索引擎源码公开,基于DHT协议
原文地址: http://www.cnblogs.com/huangxie/p/5550680.html
- cenos 安装 phpredis 扩展
1. php -m 可以查看 php 所有的已经安装的扩展
- Timer和TimerTask
目录结构: Timer和TimerTask 一个Timer调度的例子 如何终止Timer线程 关于cancle方式终止线程 反复执行一个任务 schedule VS. scheduleAtFixedR ...
- Error Correct System(模拟)
Error Correct System Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I ...
- VS2012+SQL2008+ODBC编程,第一篇博客,写的不好忘各位大神指点一二~
近期写一个数据库的课程设计,用的是C++ MFC .最開始用的是ADO技术,可是苦于网上大部分的教程都是VC6.0的,对着教程敲了4,5遍还是执行不成功.我用的IDE是VS2012,毕竟VC6.0和V ...