对于向量的向量,Eclipse方法不能被解析 [英] Eclipse method could not be resolved for vector of vectors

查看:200
本文介绍了对于向量的向量,Eclipse方法不能被解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试通过索引操作符访问向量元素的方法或字段时, bar [0] .push_back(0)载体, int> > 我得到一个方法无法解决来自eclipse的语义错误。



代码编译正好与 g ++ -Wall clang ++ - 下面是一个简短示例。

  #include< set> 
#include< vector>
#include< iostream>

int main()
{
std :: vector< std :: vector& int> > (10);
bar [0] .push_back(0); // eclipse方法'push_back'无法解决
(bar [0])。push_back(1); // eclipse方法'push_back'无法解决
bar [0] [0] ] = 0; //这个和所有其他都适用于eclipse
std :: vector< int> & bar0 = bar [0];
bar0.push_back(2);
std :: vector< int> * pbar0 =& bar [0];
pbar0-> push_back(3);
return 0;
}



我有一个类似于 std :: vector< ; std :: pair< int,int> > :: iterator 尝试访问 iter->第一。 (字段第一个无法解析)。



这是一个C / C ++项目,.cpp文件,在Eclipse 4.2.1中,没有未解决的内容。 / p>

我完全迷失在这里 - 如何摆脱这个eclipse错误?



更新:尝试使用最新版本:Juno Service Release 1.同样的结果。



Update2:我实际上注意到,我应该能够最终确定什么设置负责此错误。

解决方案

重新创建该项目从头开始修复了这个问题。看起来该项目是由以前的eclipse版本创建的,可能导致问题。由于.project和.cproject中的大量更改,无法确定具体原因。


Whenever I try to access a method or field of a vector element via a index operator, e.g. bar[0].push_back(0) on vector< vector< int > > i get a "Method could not be resolved" Semantic Error from eclipse.

The code compiles just fine with g++ -Wall or clang++ - here is a short example.

#include <set>
#include <vector>
#include <iostream>

int main()
{
    std::vector< std::vector < int > > bar(10);
    bar[0].push_back(0);    // eclipse "method 'push_back' could not be resolved
    (bar[0]).push_back(1);  // eclipse "method 'push_back' could not be resolved
    bar[0][0] = 0;      // This and all else is just fine for eclipse
    std::vector<int> &bar0 = bar[0];
    bar0.push_back(2);
    std::vector<int> *pbar0 = &bar[0];
    pbar0->push_back(3);
    return 0;
}

I have a simmilar issue with std::vector<std::pair<int, int> >::iterator trying to access iter->first. (Field 'first could not be resolved).

It is a C/C++ project, .cpp file, in Eclipse 4.2.1, there are no unresolved inclusions.

I am completely lost here - how can I get rid of this eclipse error?

Update: I have also tried this with the latest available Version: Juno Service Release 1. Same result.

Update2: I actually noticed that with a brand new project, the error does not occur, so I should be able to eventually determine what setting is responsible for this error. So far I could not identify anything, no (non inbuilt) symbols are defined and the paths look good as well.

解决方案

Recreating the Project from scratch fixed the issue. It appears that the project was created by a previous Version of eclipse, possibly causing the problem. Due to the large number of changes in .project and .cproject it was not possible to determine the specific cause.

这篇关于对于向量的向量,Eclipse方法不能被解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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