0

In the .h file:

class counting
{
public:
    vector<int> vekto[2];
....

in .cpp

counting::counting()
{   int i;
    for(i=0;i<2;i++)
    vecto[i].resize(3);//line 6
}

get error:

.cpp(6) : error C2065: 'vecto' : undeclared identifier
.cpp(6) : error C2228: left of '.resize' must have class/struct/union

where is problem?

P.S. in cpp the .h file is included.

1
  • 2
    Comon that's a spelling error: "vekto" not "vecto". Commented Nov 21, 2011 at 19:45

1 Answer 1

4

You declared your vector array as vekto, but you are referring to it as vecto. Change either of them so that they match.

Sign up to request clarification or add additional context in comments.

3 Comments

@EdgarBuchvalov - If this answer answers your question, could you accept it so that appropriate credit is given?
futhermore, tel me plz if i want to call this vektor first element i have to write: vakto[i].at(1) or there is another way?
@EdgarBuchvalov You can access the element like this: vekto[i][1]; std::vector has overloaded operator [] so that you can use them like arrays.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.