Search code examples
c++vectorsetundeclared-identifier

C++: 'set' and 'vector' "undeclared despite #include statements


I am using Netbeans 7.1 on Ubuntu 11.04.

The following call

set< Triangle > V;

gives the error message

error: ‘set’ was not declared in this scope

and the following call

vector< Triangle > ans;

gives the error message

error: ‘vector’ was not declared in this scope

This despite my having

#include <vector>
#include <set>
#include <map>

at the beginning of the C++ file.

At help resolving this would be greatly appreciated.
Peter.


Solution

  • you forgot about namespace std :

    std::set< Triangle > V; std::vector< Triangle > V;