更新时间:2015-11-01 23:32:54浏览次数:1+次
在msdn里面(http://msdn.microsoft.com/en-us/library/ms235365(VS.80).aspx)有这么一段话:
These POSIX functions are deprecated beginning in Visual C++ 2005. Use the ISO C++ conformant_stricmp, _wcsicmp, _mbsicmp, _stricmp_l, _wcsicmp_l, _mbsicmp_l instead.
意思是在Visual C++ 2005以后,stricmp, wcsicmp被_stricmp, _wcsicmp, _mbsicmp, _stricmp_l, _wcsicmp_l, _mbsicmp_l等替代了。
libidn.lib(idna.obj) : error LNK2019: unresolved external symbol __imp__stricmp
referenced in function _idna_to_unicode_internal
而这句话在vs 2005 IDE里面却不会出现。
#define strcasecmp stricmp
#define strncasecmp strnicmp
改为:
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
stricmp,_stricmp的定义在E:/Program Files/Microsoft Visual Studio 8/VC/include/string.h里面
我们可以看到如下定义(本文作者注:详细的代码我在我写的《_stricmp函数与stricmp函数小解》一文中,用图片形式凸显了这个函数的定义,方便你查看):
#if !__STDC__
....................
/* prototypes for oldnames.lib functions */
_CRT_NONSTDC_DEPRECATE(_strcmpi) _CRTIMP __checkReturn int __cdecl strcmpi(__in_z const char * _Str1, __in_z const char * _Str2);
_CRT_NONSTDC_DEPRECATE(_stricmp) _CRTIMP __checkReturn int __cdecl stricmp(__in_z const char * _Str1, __in_z const char * _Str2);
_CRT_NONSTDC_DEPRECATE(_strlwr) _CRTIMP char * __cdecl strlwr(__inout_z char * _Str);
_CRT_NONSTDC_DEPRECATE(_strnicmp) _CRTIMP __checkReturn int __cdecl strnicmp(__in_z const char * _Str1, __in_z const char * _Str, __in size_t _MaxCount);
_CRT_NONSTDC_DEPRECATE(_strnset) _CRTIMP char * __cdecl strnset(__inout_ecount_z(_MaxCount) char * _Str, __in int _Val, __in size_t _MaxCount);
_CRT_NONSTDC_DEPRECATE(_strrev) _CRTIMP char * __cdecl strrev(__inout_z char * _Str);
_CRT_NONSTDC_DEPRECATE(_strset) char * __cdecl strset(__inout_z char * _Str, __in int _Val);
_CRT_NONSTDC_DEPRECATE(_strupr) _CRTIMP char * __cdecl strupr(__inout_z char * _Str);
#endif /* !__STDC__ */
从上面可以看出,如果__STDC__ 为0,则会有stricmp的定义,否则就没有。转自CSDN。
在这里本文作者解释下在《_stricmp函数与stricmp函数小解》一文中的VC编译器的string.h中函数的定义前都一个_cdecl,这是调用约定,与此函数相同功能的函数有_stdcall,还有就是win32编译时的WINAPI函数。WINAPI在WINDEF.H中被定为:#define WINAPI _stdcall;
相关资讯