使用`__FUNCTIONW__`时出现智能感知错误 [英] Intellisense error when using `__FUNCTIONW__`

查看:234
本文介绍了使用`__FUNCTIONW__`时出现智能感知错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用__LINE____FILEW____FUNCTIONW__宏来帮助编写和实现自定义异常类.众所周知,它们会在调用它们的代码中自动提供行号,源文件名和函数名.另外,由于我只使用Unicode,因此必须使用扩展到字符串结果的那些字符的 ... W 宽字符版本.

I am using the __LINE__, __FILEW__ and __FUNCTIONW__ macros to aid in the writing and implementation of a custom exception class. As is well known, they automatically provide the line number, source-file name and function name of the location in code from where they are called. Also, as I am working exclusively in Unicode I must use the ...W wide character versions of those that expand to a string result.

例如:

throw CEString(CEString::ERROR_INDEX_OUT_OF_BOUNDS,
                __LINE__,
                L"End index is smaller than start index",
                L"Index Out of Bounds",
                __FILEW__,
                __FUNCTIONW__,
                L"CString");

CEString是一个自定义异常类,其构造函数使用两个整数参数,然后使用五个简单的宽字符串来定位和描述引发该错误的错误.

Where CEString is a custom exception class whose Constructor takes two integer arguments and then five simple wide strings to locate and describe the error for which it is thrown.

我正确包含了头文件iostreamnewcrtdefs.h.从文档上来看,后者并不是绝对必要的,但是由于实际上是定义宏的地方,所以无论如何我都将其包括在内.但是, VS2013 中的 Intellisense 错误检查器突出显示了我使用__FUNCTIONW__宏作为错误.它返回以下通知:

I have the header files iostream, new and crtdefs.h properly included. Going from the documentation the latter should not be strictly necessary, but as it is where the macros are actually defined I have included it anyway. However, the Intellisense error-checker in VS2013 highlights my use of the __FUNCTIONW__ macro as an error. It returns the following notification:

错误:标识符L__FUNCTION__未定义.

...这很奇怪!

这变得更加陌生的地方;尽管有此错误警告,程序本身还是可以愉快地编译,甚至可以按预期运行.据说值得商bat的宏在没有任何抱怨的情况下创建了其宽字符的函数名扩展.

Where this becomes even stranger is; the programme itself - despite this error warning - compiles happily and what is more even runs as expected. The supposedly debatable macro creates its wide-character function-name expansion without any complaint.

所以这显然是 Intellisense 的问题,而不是代码或标头.你们中的任何家伙都知道可能出了什么问题吗?

So this is obviously a problem with Intellisense, not the code or headers. Do any of you chaps have an idea what might be going wrong?

这可能是上一个最接近的问题:

This is probably the closest previous question :

为什么未定义__FUNCTION__?

但是,与Ben Voight不同,我发现该程序确实可以链接并运行!问题显然与Intellisense有关.

However, unlike Ben Voight I find the programme does actually link and run! The problem is explicitly with Intellisense.

推荐答案

此错误已公开给即使在VS2010(自定义或内置)中,Intellisense似乎通常也存在宏问题

Intellisense generally seems to have problems with macros even in VS2010 ( self defined or built in )

您现在可以忽略该错误.

You should be okay ignoring the error for now.

可能会让您对我的意思有所了解

Also this might give you some insight in what I mean.

这篇关于使用`__FUNCTIONW__`时出现智能感知错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆