简体   繁体   English

C3867:'_com_error :: Description':非标准语法 使用“&”创建指向成员的指针

[英]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.

相关问题 c3867&#39;sf::Time::as seconds&#39;:非标准语法;使用&#39;&amp;&#39;创建指向成员的指针 - c3867'sf::Time::as seconds':non-standard syntax ;use '&'to create a pointer to a member “错误C3867:非标准语法; 使用虚拟流操纵器时,使用“&”创建指向成员的指针” - “Error C3867: non-standard syntax; use '&' to create a pointer to member” when using virtual stream manipulator Visual Studio 2015 错误 C3867 &#39;Rectangle::get_area&#39;:非标准语法; 使用“&amp;”创建指向成员的指针 - Visual Studio 2015 Error C3867 'Rectangle::get_area': non-standard syntax; use '&' to create a pointer to member std::unordered_map 中的 std::function,错误 C3867 非标准语法; 使用 '&amp;' 创建指向成员的指针 - std::function in std::unordered_map, error C3867 non-standard syntax; use '&' to create a pointer to member 获取错误:C3867 &#39;Template_class<int> ::add&#39;: 非标准语法; 使用带有模板的函数指针时 - Getting error : C3867 'Template_class<int>::add': non-standard syntax; when using pointers to functions with templates 非标准语法; 使用 '&amp;' 创建指向成员 C++ 的指针 - non-standard syntax; use '&' to create a pointer to member C++ 错误信息:非标准语法; 使用“&amp;”创建指向成员的指针 - Error Message: non-standard syntax; use '&' to create a pointer to member 错误1错误C3867:&#39;Command :: getSecondWord&#39;:函数调用缺少参数列表; 使用“&”创建指向成员的指针 - Error 1 error C3867: 'Command::getSecondWord': function call missing argument list; use '&' to create a pointer to member 尝试使用指向函数的指针将模板化 class 的方法传递给另一个 class 时,出现错误 C3867 使用“&”创建指向成员的指针 - While trying to pass a method of a templated class to another class using pointer to functions,get Error C3867 use '&' to create a pointer to a member 非标准语法; 使用“&”创建指向成员的指针 - non-standard syntax; use '&' to create a pointer to member
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM