头文件 Strsafe.h 定义了有问题的方法,使用两个定义来过滤这个函数,如下所示:
#if defined(STRSAFE_LOCALE_FUNCTIONS) && !defined(STRSAFE_NO_CB_FUNCTIONS)
/*++
STDAPI
StringCbPrintf_l(
_Out_writes_bytes_(cbDest) _Always_(_Post_z_) LPTSTR pszDest,
_In_ size_t cbDest,
_In_ _Printf_format_string_params_(2) LPCTSTR pszFormat,
_In_ locale_t locale,
...
);
Routine Description:
This routine is a version of StringCbPrintf that also takes a locale.
Please see notes for StringCbPrintf above.
--*/
#ifdef UNICODE
#pragma region Application Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define StringCbPrintf_l StringCbPrintf_lW
// ...
简而言之,您需要STRSAFE_LOCALE_FUNCTIONS
在包含标题之前进行定义。如:
#define STRSAFE_LOCALE_FUNCTIONS
#ifdef STRSAFE_NO_CB_FUNCTIONS
#pragma message("NO CB FUNCTIONS")
#endif
#include <strsafe.h>