[英]C3867 : '_com_error::Description': non-standard syntax; use '&' to create a pointer to member
i want to catch exception while connecting to Database and I'm using try catch, i use pointer but anyway it gives me such kind of error. 我想在连接数据库时捕获异常,而我正在使用try catch,但是我使用了指针,但是无论如何它给了我这种错误。 C3867 '_com_error::Description': non-standard syntax; use '&' to create a pointer to member
C3867 '_com_error::Description': non-standard syntax; use '&' to create a pointer to member
. C3867 '_com_error::Description': non-standard syntax; use '&' to create a pointer to member
。 also there is not red line on e.Description, it just gives me this massage in error list. 在e.Description上也没有红线,它只是给我这个错误列表中的信息。 What is solution? 什么是解决方案? Thank you in advance. 先感谢您。
try
{
}
catch (_com_error &e)
{
printf(e.Description);
}
_com_error::Description is a function. _com_error :: Description是一个函数。
you need to use the (): 您需要使用():
try
{
}
catch (_com_error &e)
{
printf(e.Description());
}
On a sidenote: Description() returns a _bstr_t, which might not work well with printf()... 在旁注:Description()返回一个_bstr_t,它可能不适用于printf()...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.