Who is are
Who is are

Reputation: 173

#include<vector> no such file or directory 2

I need to use vectors in my project.

#include <vector>
vector <wordStatistics> WORD_STATS[NUMBER_OF_LETTERS][NUMBER_OF_LETTERS];

and I have some errors.

error: expected constructor, destructor, or type conversion before '<' token

I`m using linux

Upvotes: 1

Views: 17023

Answers (1)

sehe
sehe

Reputation: 393769

Make sure you compile as c++ (standard for .cpp extensions).

Here's a free hint:

#include <vector>

std::vector <wordStatistics> WORD_STATS(NUMBER_OF_LETTERS);

It doesn't make much sense to use a C-style array of vectors and it is likely not what you wanted. Instead, this creates a single vector with NUMBER_OF_LETTER elements.

Upvotes: 4

Related Questions