php cannot instantiate abstract class,VS2008:error C2259 cannot instantiate abstract class

Visual Studio2008编译错误error C2259 cannot instantiate abstract

class

经过检查,发现源代码中确实已经派生了虚函数,派生的虚函数源文件也正常编译。

最后在微软的官方网站上找到了答案(可能只是error C2259其中一种可能的原因,供参考):

This behavior is by design with VS 2005. The root cause is

because wchar_t is a different type than unsigned short though in

prior versions of Visual C++, the compiler considered them to be

the same type. In this sample code, the type library uses unsigned

short but the C++ source files use wchar_t. So the types don’t

match therefore the functions that contain these types in their

signatures don’t override the interface.

在VS 2005/VS2008中,wchar_t和unsigned short是不同的类型,尽管在之前的Visual

C++版本中编译器将两者视为了相同的类型。由于参数类型的不匹配导致编译器无法正确地识别或编译重载的接口。

To continue working with this sample, either correct the type

mismatch or use the /Zc:wchar_t- compiler switch to force the

compiler to consider wchar_t the same type as unsigned short.

In the VS 2005 project property properties, under the C/C++ node,

select Language. Then change “Treat wchar_t as Built-In Type” from

“Yes” to “No”.

解决办法:使用/Zc:wchar_t-编译选项强制让编译器将wchar_t 和 unsigned short视为相同类型。或者在VS

2005/VS2008中,将项目属性中将”Treat wchar_t as Built-In Type”一项设置为”No”.

微软相关链接地址:

博客来源:http://nariver.com/archives/486

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值