IDE无法识别该方法

时间:2015-06-17 06:58:50

标签: c++ dictionary hash qt-creator code-completion

我试图访问City类中的cityMethod()。

class City
{
    void cityMethod() { }
}

所以,我这样做:

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

现在,当我这样做时:

mymap["Madrid"].cityMethod();

好的,它有效。但是IDE(Qt)并没有认识到&#34; cityMethod&#34;。 难道我做错了什么?是编译问题吗?

1 个答案:

答案 0 :(得分:0)

Qt Creator似乎不支持此功能。在issue上有关于它的公开http://bugreports.qt.io/

虽然使用ClangCodeModel插件时可以正常工作。要使用它,请转到帮助&gt;关于插件并在那里激活插件:

enter image description here

然后,在选项中启用它。工具&gt;选项&gt; C ++&gt;代码模型

enter image description here

您可能会遇到Clang代码模型的性能问题,但它确实有效:

enter image description here

相关问题