C++ Intellisense 显示结构化绑定错误但代码编译
C++ Intellisense showing errors with structured bindings but code compiles
我已经使用 VS 很长时间了,在我看来这是一个很好的 IDE,但有时智能感知会中断并报告不存在的错误。通常这些会在一段时间后消失,或者在重建智能感知缓存后消失,但这次它实际上似乎被卡住了。这在我的 IDE 中的样子:(这是 VS2017)
当鼠标悬停在名称 'position' 上时,我收到如下消息:class "Saturn::Components::Transform" has no member named "position"
,而它显然有一个,在编译代码时变得很清楚,它工作得很好。
一段时间以来,我一直在到处更改设置,但我不知道如何解决这个问题。非常感谢任何帮助!
据我所知,IntelliSense 由不同的编译器前端提供(基于 EDG frontent) than the one the Visual C++ compiler uses. Thus, it happens from time to time that there are discrepancies between what IntelliSense thinks is valid code and what the Visual C++ compiler will accept when your code is actually compiled. For example, when Visual C++ adds new, experimental features, IntelliSense will often not yet be updated to know about them and mark the corresponding code as erroneous. This also goes the other way,因为 EDG 前端至少在历史上比 Visual C++ 具有更好的标准一致性,因此它可能会发生 IntelliSense 会认为某些代码有效,而 Visual C++,当你实际编译代码时,会抱怨(这比最近几个版本的 Visual C++ 有了显着改善,不过,人们看到这种情况越来越少发生)。最重要的是,这些前端中的每一个都有自己独立的一组错误…
最有可能的是,您的结构化绑定所发生的情况是您使用的 VS 2017 版本中的 IntelliSense 还不支持结构化绑定。据我所知,当他们在 VS 2017 Update 3(或大约那个时候)中引入该功能时,这曾经是一个问题。您可能需要考虑将您的 VS 2017 更新到更新的版本,因为我似乎无法在此处使用当前的 VS 2017(版本 15.9.11)重现此问题......
我已经使用 VS 很长时间了,在我看来这是一个很好的 IDE,但有时智能感知会中断并报告不存在的错误。通常这些会在一段时间后消失,或者在重建智能感知缓存后消失,但这次它实际上似乎被卡住了。这在我的 IDE 中的样子:(这是 VS2017)
当鼠标悬停在名称 'position' 上时,我收到如下消息:class "Saturn::Components::Transform" has no member named "position"
,而它显然有一个,在编译代码时变得很清楚,它工作得很好。
一段时间以来,我一直在到处更改设置,但我不知道如何解决这个问题。非常感谢任何帮助!
据我所知,IntelliSense 由不同的编译器前端提供(基于 EDG frontent) than the one the Visual C++ compiler uses. Thus, it happens from time to time that there are discrepancies between what IntelliSense thinks is valid code and what the Visual C++ compiler will accept when your code is actually compiled. For example, when Visual C++ adds new, experimental features, IntelliSense will often not yet be updated to know about them and mark the corresponding code as erroneous. This also goes the other way,因为 EDG 前端至少在历史上比 Visual C++ 具有更好的标准一致性,因此它可能会发生 IntelliSense 会认为某些代码有效,而 Visual C++,当你实际编译代码时,会抱怨(这比最近几个版本的 Visual C++ 有了显着改善,不过,人们看到这种情况越来越少发生)。最重要的是,这些前端中的每一个都有自己独立的一组错误…
最有可能的是,您的结构化绑定所发生的情况是您使用的 VS 2017 版本中的 IntelliSense 还不支持结构化绑定。据我所知,当他们在 VS 2017 Update 3(或大约那个时候)中引入该功能时,这曾经是一个问题。您可能需要考虑将您的 VS 2017 更新到更新的版本,因为我似乎无法在此处使用当前的 VS 2017(版本 15.9.11)重现此问题......