Làm thế nào để liên kết với msvcr90.dll với mingw gcc? Tôi cố gắng -lmsvcr90, đây là ví dụ nhỏ:Làm thế nào để liên kết với msvcr90.dll với mingw gcc?
#include <stdio.h>
int main(int argc, const char *argv[]) {
printf("%s\n", "hello");
return 0;
}
OS của tôi là win7, với mingw gcc 4.5.0
$ gcc -v
...
gcc version 4.5.0 (GCC)
$ gcc hello.c -lmsvcr90
$ a
Sau đó, tôi đã nhận lỗi này:
R6034
An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.
Tôi thiếu phần nào?
edit1:
@ user440813 Dường như mingw của tôi rất khác với của bạn.
$ 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
Sau đó, tôi chế giễu int atexit (void (* function) (void)) {return 0;}
và có R6034 một lần nữa ...