如何使用mingw gcc链接到msvcr90.dll?我尝试了-lmsvcr90,这里是最简单的示例:
#include <stdio.h>
int main(int argc, const char *argv[]) {
printf("%s\n", "hello");
return 0;
}
我的操作系统是win7,使用的是mingw gcc 4.5.0
$ gcc -v
...
gcc version 4.5.0 (GCC)
$ gcc hello.c -lmsvcr90
$ a
然后我遇到了这个错误:
R6034
应用程序尝试不正确地加载 C 运行时库。 请联系应用程序的支持团队以获取更多信息。
我错过了哪一部分?
编辑1:
@user440813 看起来我的 mingw 和你的非常不同。
$ gcc h.c -nostdlib -lmsvcr70 -lgcc -o h.exe
d:/mingw/bin/../lib/gcc/mingw32/4.5.0/libgcc.a(__main.o):(.text+0x5a): undefined reference to `atexit'
d:/mingw/bin/../lib/gcc/mingw32/4.5.0/libgcc.a(__main.o):(.text+0xc2): undefined reference to `atexit'
collect2: ld returned 1 exit status
我模拟了int atexit ( void ( * function ) (void) ) {return 0;}
,然后再次出现R6034错误...