是Visual C ++ intellisense“更聪明”比编译器 [英] Is Visual C++ intellisense "smarter" than the compiler

查看:301
本文介绍了是Visual C ++ intellisense“更聪明”比编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下情况。

我有一个类派生的基类。一切看起来不错,但是,每当我将鼠标光标悬停在基类的继承成员上时,intellisense显示它很好,EG BaseClass :: SomeMember。然而,当我尝试编译,编译器显示各种错误(他们是关于变量和成员函数,intellisense报告很好)。编译器说它们不是有效的标识符,它们不属于全局命名空间。

I have a base class from which a class derives. Everything appears good however, every time I hover my mouse cursor over an inherited member of the base class, the intellisense shows it fine, EG BaseClass::SomeMember. However, when I try to compile, the compiler shows various errors(they are about the variables and member functions that the intellisense was reporting well). The compiler says 'they're not valid identifiers', that they don't 'belong to a global namespace'. Does anyone know why this is occurring?

推荐答案

如果这是VC2010,那么在某种意义上Intellisense更聪明。
他们切换到使用EDG的编译器前端为IntelliSense,这是一个更严格,更符合标准的编译器比微软自己的。所以有些情况下IntelliSense和真正的编译器不同意。

If this is VC2010, then yes, in a sense Intellisense is smarter. They switched to using EDG's compiler frontend for IntelliSense, and that is a stricter, more standards-compliant compiler than Microsoft's own one. So there are cases where IntelliSense and the "real" compiler disagrees.

有时IntelliSense是错误的,因为它没有完整的图片(它运行在不同的上下文,并且每次只处理一小段代码),有时Intellisense是正确的,编译器错误(就C ++标准合规性而言),因为EDG的前端在这方面更好。

Sometimes IntelliSense is wrong because it doesn't have the complete picture (it runs in a different context, and processes only small snippets of the code at a time), and sometimes Intellisense is right and the compiler is wrong (in terms of C++ standard compliance), because EDG's frontend is just better in that respect.

这篇关于是Visual C ++ intellisense“更聪明”比编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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