如何用mingw gcc链接msvcr90.dll?我试过-lmsvcr90,这是最小的例子:
#include <stdio.h>
int main(int argc, const char *argv[]) {
printf("%s\n", "hello");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我的操作系统是win7,mingw gcc 4.5.0
$ gcc -v
...
gcc version 4.5.0 (GCC)
$ gcc hello.c -lmsvcr90
$ a
Run Code Online (Sandbox Code Playgroud)
然后我收到了这个错误:
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.
我错过了哪一部分?
EDIT1:
@ 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: …Run Code Online (Sandbox Code Playgroud)