简体   繁体   English

IDE无法识别该方法

[英]IDE doesn't recognize the method

I'm trying to acces the cityMethod() inside the class City. 我正在尝试在City类中访问cityMethod()。

class City
{
    void cityMethod() { }
}

So, I do: 因此,我这样做:

map<string,City> mymap;
City c;
mymap["Madrid"] = c;

Now, when I do this: 现在,当我这样做时:

mymap["Madrid"].cityMethod();

Ok, it works. 好的,可以。 But the IDE(Qt) doesn't recognize the "cityMethod". 但是IDE(Qt)无法识别“ cityMethod”。 Am I doing something wrong? 难道我做错了什么? Is that compiler issue? 那是编译器问题吗?

This feature does not seem to be supported by Qt Creator. Qt Creator似乎不支持此功能。 There's an open issue about it on http://bugreports.qt.io/ . http://bugreports.qt.io/上有一个未解决的问题

It does work when using the ClangCodeModel plugin though. 使用ClangCodeModel插件时,它确实可以工作。 To use it, go to Help > About Plugins and activate the plugin there: 要使用它,请转到“帮助”>“关于插件”并在那里激活插件:

在此处输入图片说明

Then, enable its use in the options. 然后,在选项中启用它的使用。 Tools > Options > C++ > Code Model 工具>选项> C ++>代码模型

在此处输入图片说明

You might experience performance issues with the Clang code model, but it does work: 您可能会遇到Clang代码模型的性能问题,但是它确实可以工作:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM