Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 310
Abhipso Ghosh Avatar asked Oct 16 '25 16:10

Abhipso Ghosh


1 Answers

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

g++ -std=c++11 your_file.cpp -o your_program
like image 70
pSoLT Avatar answered Oct 18 '25 06:10

pSoLT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!