lui*_*ore 5 gcc mingw msvcr90.dll
如何用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: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
然后我嘲笑int atexit ( void ( * function ) (void) ) {return 0;}
并再次获得R6034 ......
小智 4
尝试
gcc hello.c -nostdlib -lmsvcr90 -lgcc -o hello.exe
Run Code Online (Sandbox Code Playgroud)
反而。msvcr90
我对您最初的编译尝试成功感到有点惊讶,因为和之间应该存在冲突的定义msvcrt
(MinGW 默认链接)。这样,冲突的内容不会msvr90
被链接,但会被添加以初始化运行时库。msvcrt
libgcc
我的计算机上没有msvcr90.dll
,但我能够验证类似的调用是否适用于msvcr100.dll
.
归档时间: |
|
查看次数: |
4968 次 |
最近记录: |