Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'vector' in namespace 'std' does not name a type

Tags:

c++

std

stdvector

I am developing a C++ application using CodeBlocks 10.05 on Debian 7.0.0.

For some reason, the following code

#include <iostream>  std::vector< int > delaunayDiv(const std::vector< int <T> > & vP, cv::Rect boundRect,     std::vector<int>& triangles, int& numTriangles, bool lookRight); 

returns the following error

error: 'vector' in namespace 'std' does not name a type 
like image 496
OtagoHarbour Avatar asked Jun 01 '13 01:06

OtagoHarbour


People also ask

Is vector in std namespace?

Vectors in C++C++ has a vector class within the std namespace. A vector is similar to an array, in a sense where a series of elements are stored with the same variable name. Unlike arrays, vectors are dynamically sized, which is a major advantage.

What does vector does not name a type mean?

The reason the compiler says “vector is not a type” is that vector is not a type. It's a template from which types can be made.

How do you add to a vector in C++?

Appending to a vector means adding one or more elements at the back of the vector. The C++ vector has member functions. The member functions that can be used for appending are: push_back(), insert() and emplace(). The official function to be used to append is push_back().


1 Answers

You should include the vector header:

#include <vector> 
like image 167
taocp Avatar answered Oct 04 '22 17:10

taocp