用 comsupp.lib/comsuppd.lib 还是 comsuppw.lib/comsuppwd.lib

曾经用过 _bstr_t 类,MSDN 提示包含的库为 comsuppw.lib 或 comsuppwd.lib。

 

最近看到了 comsupp.lib 和 comsuppd.lib,到底该用哪个呢?

 

从 MSDN 得知:

(1) 当指定了 /Zc:wchar_t  时,应该使用comsuppw.lib/comsuppwd.lib;

(2) 当指定了 /Zc:wchar_t- 时,应该使用comsupp.lib/comsuppd.lib。

P.S.:/Zc:wchar_t 或 /Zc:wchar_t- 可通过“项目属性 -> 配置属性 -> C/C++ -> 语言 -> 将 WChar_t  视为内置类型”设定。

 

原文:

Explicit references to comsupp.lib, either from the comment pragma or via the command line, should be changed to now use either comsuppw.lib or comsuppwd.lib, as /Zc:wchar_t is now on by default. comsupp.lib should still be used when compiling with /Zc:wchar_t-.

 

如果希望代码能根据项目属性设置而自适应,可以通过 _NATIVE_WCHAR_T_DEFINED 来判定。代码如下:

 

关于两个宏的解释如下:

_WCHAR_T_DEFINED: Defined when /Zc:wchar_t is used or if wchar_t is defined in a system header file included in your project. 

_NATIVE_WCHAR_T_DEFINED: Defined when /Zc:wchar_t is used.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值