Abhipso Ghosh
Abhipso Ghosh

Reputation: 555

error: 'unordered_set' is not a member of 'std'

In C++, I am trying to declare an unordered_set simply like this:

std::unordered_set<int> k;

But it is showing this error:

error: 'unordered_set' is not a member of 'std'

I am using g++ (GCC) 5.3.0 on windows using MinGW. Here are the things that I have already considered:

  1. Adding the header file by #include <unordered_set>
  2. Upgrading MinGW
  3. Using the flag -std=gnu++11. (This is not generating any executable or error, not sure if it doing anything or not)

How to fix it and compile my code successfully?

Upvotes: 4

Views: 11694

Answers (1)

pSoLT
pSoLT

Reputation: 1052

Use -std=c++11 switch and specify output file.

g++ -std=c++11 your_file.cpp -o your_program

Upvotes: 9

Related Questions