IPP 6.1 sample code中的compile error:'vswprintf' : too few arguments for call

在Ipp6.1的samplecode-Audio-Video-Codecs的compile过程中,遇到vswprintf错误提示。文章详细分析了错误原因及解决方案,包括vswprintf的多种定义和如何正确调用以兼容ISOC标准。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Ipp 6.1的sample code - Audio-Video-Codecs的compile过程中发现有提示Error:

vm_file_win.c(1173): error C2198: 'vswprintf' : too few arguments for call

vswprintf是一个MACRO,通过查看vswprintf的定义可以发现,他VC安装目录里有不同的定义,分别是:

int __cdecl _vswprintf (
        wchar_t *string,
        const wchar_t *format,
        va_list ap
        );


int __cdecl vswprintf (
        wchar_t *string,
        size_t count,
        const wchar_t *format,
        va_list ap
        );


他们的差别在于,后者多了一个参数 “size_t count”,表示buffer允许的最大长度。

在MSDN里有这样的解释:

In Visual C++ 2005, swprintf conforms to the ISO C Standard, which requires the second parameter, count, of type size_t. To force the old nonstandard behavior, define _CRT_NON_CONFORMING_SWPRINTFS. In a future version, the old behavior may be removed, so code should be changed to use the new conformant behavior.

所以,后者是为了兼容ISO C Standard,如果你需要使用MicroSoft 提供的较旧版本,需要增加宏定义:

_CRT_NON_CONFORMING_SWPRINTFS



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值