该错误主要是由于静态库在VC6编译而主程序在VC2005编译,大家用的CRT不同。解决办法,代码中增加
#ifdef __cplusplus
 extern "C" 
 #endif
 FILE _iob[3] = {__iob_func()[0], __iob_func()[1], __iob_func()[2]};
此错误的产生根源:
 在VC6的stdio.h之中有如下定义
_CRTIMP extern FILE _iob[];
 #define stdin (&_iob[0])
 #define stdout (&_iob[1])
 #define stderr (&_iob[2])
stdin、stdout、stderr是通过查_iob数组得到的。所以,VC6编译的程序、静态库只要用到了printf、scanf之类的函数,都要链接_iob数组。
而在vc2005中,stdio.h中变成了
_CRTIMP FILE * __cdecl __iob_func(void);
 #define stdin (&__iob_func()[0])
 #define stdout (&__iob_func()[1])
 #define stderr (&__iob_func()[2])
_iob数组不再是显式的暴露出来了,需要调用__iob_func()函数获得。所以vc6的静态库链接VC2005的C运行库就会找不到_iob数组.
 通过重新定义
 FILE _iob[3] = {__iob_func()[0], __iob_func()[1], __iob_func()[2]};
 就把vc6需要用到的_iob数组搞出来了